• Welcome, Guest. Please login.
July 23, 2021, 07:26:02 PM


Welcome to the SQLitening support forums!

How do I determine if another program has locked the database?

Started by Ian Vincent, July 26, 2011, 12:13:16 PM

Previous topic - Next topic

Ian Vincent

Great work on SQLitening. I have been using Ptree and Cheetah for some years now, but SQLitening opens up a whole new world.

I do have a minor problem though -
I find that when another program (eg SQLite Expert) is running and I am using it to look at my database
that updates from my PB code to the database fail without error.

I am probably missing the obvious here, but how can I check to see if the database is able to accept my inserts?

What is even stranger (to me anyway) is that queries can also return an incorrect result :

   slSel "Select Count(*) As RowCount From Housekeeping where "+catdesc+"='"+filename+"'"
   Function= Val(slF(1))

Here I am checking  a table to see if a file has already been loaded - all I want is a count of the times it appears.
If greater than zero, I skip it. But when another program like SQLite Expert is using the database, the function always returns
1, even though the entry is not there.
Exiting SQLite Expert and restarting my program, and everything works as it should.

Any suggestions appreciated.


Fred Meier

Are you running Local or Remote?
I also use SQLite Export and it does not lock the database by default.  How are you getting it to lock your database?

QuoteI am probably missing the obvious here, but how can I check to see if the database is able to accept my inserts?
There is no "IsDatabaseLocked" command.  If there was it could sat "No" but then when you wanted to update it could be locked. You can do Begin Exclusive to ensure you have the database locked.  Not recommended in a multi user environment.  I just do the update assuming it will work, if locked then I allow standard error handling to occur.

I can not duplicate any of your problems so you would need to post your database and a program that causes the errors.

Ian Vincent

Thanks Fred.
I will investigate some more and see if I can generate some small code to demonstate the issue.


Ian Vincent

Just to put it all to bed - and own up to my mistake  - it will come as no surprise, it was something I was doing.
SQLite and SQLitening are working fine.