• Welcome, Guest. Please login.
 
May 26, 2019, 12:46:10 am

News:

Welcome to the SQLitening support forums!


Wait if all transaction are read-only?

Started by mikedoty, September 12, 2007, 10:03:07 am

Previous topic - Next topic

mikedoty

September 12, 2007, 10:03:07 am Last Edit: September 12, 2007, 10:08:41 am by mikedoty
Is a transaction held before passing to sqlite if all transactions before it are read-only transactions?
Is there even a pragma for opening a database in exclusive mode?

Paul Squires

Do you mean that you are issuing an "BEGIN" transaction, then performing additional sql statements? It is my understanding that a transaction remains open when the "BEGIN" is issued until the final "COMMIT" is issued. If no "COMMIT" is issued then sql3server will issue a "COMMIT" before it closes the database on exit.

Having said that, the "Definitive Guide (page 147)" states that ALL Sqlite statements are implicitly wrapped in transactions if no explicit BEGIN/COMMIT pair is given. I guess the only real downside to this is that a transaction is opened/closed for every individual sql statement whereas if you send a block of statements with an explicit starting "BEGIN" and an ending "COMMIT" then all of those statements will exist within the one transaction. May be a little bit of a performance gain?

I am not sure if there is a pragma for exclusive mode but maybe it is not needed anyway because the database is always put into exclusive lock mode prior to any writes.

mikedoty

Sorry, I was mistaken in thinking your code held transactions before passing to SQLite.