• Welcome to SQLitening Support Forum. Please login.
 
December 03, 2021, 06:02:31 PM

News:

Welcome to the SQLitening support forums!


Database Open questions

Started by Skip, August 18, 2013, 12:35:28 PM

Previous topic - Next topic

Skip

Is there a way to detect a currently opened database?

Thanks in advance -

Skip

Rolf Brandt

August 18, 2013, 03:35:26 PM #1 Last Edit: August 18, 2013, 03:51:26 PM by Rolf Brandt
From the Help file:

slIsOpen () Long
Returns %TRUE if there is a database open.

Additionally:

slGetDatabaseAndFileNames  () String
Returns a list of database and file names that are currently opened and attached.  The name entries are returned as a delimited text string which is $NUL separated.  Each entry contains two elements, a database name and a file name. The two elements are separated by the vertical bar (|) character. The first entry is always the Main database from the slOpen command.  The second entry will be the Temp database, but only if there are temporary tables currently created.  The rest of the entries, if any, will be the attached databases.  There are no file names assigned to temporary tables nor temporary databases. Will return an empty string if there is no open database.

These functions of course will detect only if they are opened by your program, not by another program.

Rolf
I like to cook with wine - sometimes I even add it to the food.
www.rbsoft.eu

Skip

Rolf -

Thanks much for the reply!

I especially liked the additional info you responded with.  Since slIsOpen() doesn't allow one to
ask which database is open, I'll probably want to also explore your 2nd method.

Skip