• Welcome, Guest. Please login.
July 06, 2020, 03:45:41 pm


Welcome to the SQLitening support forums!

db handle management

Started by Bern Ertl, March 18, 2009, 04:49:55 pm

Previous topic - Next topic

Bern Ertl

What is the best way to manage multiple database handles in a function when you need to open a database (guaranteed not to be open at the time) and it's 50/50 odds that another database is already open?

What does the slPushDatabase function do if no database is open?  Assuming it doesn't push anything onto the stack, what happens if you call slPopDatabase with an empty stack?

Fred Meier

slPushDatabase will push a zero value onto the internal stack if no
database is open.  The subsequent slPopDatabase will pop the zero value
back into the global database handle, so all is fine. 

I did notice a bug if you do a Pop without a Push, a GPF will occur. 
This will be fixed in next release.  As long as the Push and Pop are used
in pairs there should be no problem

I do a Push/Pop all the time within lower level Dll's without knowing if a
database is currently open.   Works fine.

Bern Ertl