Bud Beacham <[EMAIL PROTECTED]> writes: > In the book, SQLite (version 2.x of SQLite) by Chris Newman, he writes on > page 184 that a way to test a Tcl callback function for a locked database is > to issue a BEGIN TRANSACTION in one session and run the program in another > session.
Note the book title: version 2.x. If you're using version 3, transactions work a bit differently with the same BEGIN TRANSACTION command. To get the behavior of 2.x while using 3.x, issue BEGIN EXCLUSIVE instead of just BEGIN or BEGIN TRANSACTION. BEGIN EXCLUSIVE will lock the database immediately (as was done by BEGIN TRANSACTION in 2.x), whereas BEGIN (without EXCLUSIVE or any other qualifier) will wait until the transaction is actually required (e.g. an INSERT is issued) before obtaining the lock. Look at sqlite.org documentation for an explanation of the various ways to use transactions. Cheers, Derrell