3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
10 #***********************************************************************
14 # Verify that a busy callback waiting on a reserved lock resolves
15 # once the lock clears.
17 # $Id: tkt3093.test,v 1.2 2008/05/02 14:23:55 drh Exp $
20 set testdir [file dirname $argv0]
21 source $testdir/tester.tcl
23 # Set up a test database
28 INSERT INTO t1 VALUES(1);
33 # Establish a separate, independent connection to that database.
36 catch {sqlite3_enable_shared_cache 0}
43 # Make sure that clearing a lock allows a pending request for
44 # a reserved lock to continue.
47 # This will be the busy callback for connection db2. On the first
48 # busy callback, commit the transaction in db. This should clear
49 # the lock so that there should not be a second callback. If the
50 # busy handler is called a second time, then fail so that we get
52 proc busy_callback {cnt} {
60 db2 busy ::busy_callback
62 # Start a write transaction on db.
65 INSERT INTO t1 VALUES(2);
68 # Attempt to modify the database on db2
74 # Verify that everything worked as expected. The db transaction should
75 # have gone first and added entry 2. Then the db2 transaction would have
76 # run and added one to each entry.
79 db eval {SELECT * FROM t1}
82 db2 eval {SELECT * FROM t1}