3 # May you do good and not evil.
4 # May you find forgiveness for yourself and forgive others.
5 # May you share freely, never taking more than you give.
7 #***********************************************************************
10 set testdir [file dirname $argv0]
11 source $testdir/tester.tcl
13 ifcapable !fts3||!shared_cache {
19 set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
21 # Open two connections to the database in shared-cache mode.
26 # Create a virtual FTS3 table. Populate it with some initial data.
28 do_execsql_test fts3shared-1.1 {
29 CREATE VIRTUAL TABLE t1 USING fts3(x);
31 INSERT INTO t1 VALUES('We listened and looked sideways up!');
32 INSERT INTO t1 VALUES('Fear at my heart, as at a cup,');
33 INSERT INTO t1 VALUES('My life-blood seemed to sip!');
34 INSERT INTO t1 VALUES('The stars were dim, and thick the night');
38 # Open a write transaction and insert rows into the FTS3 table. This takes
39 # a write-lock on the underlying t1_content table.
41 do_execsql_test fts3shared-1.2 {
43 INSERT INTO t1 VALUES('The steersman''s face by his lamp gleamed white;');
46 # Now try a SELECT on the full-text table. This particular SELECT does not
47 # read data from the %_content table. But it still attempts to obtain a lock
48 # on that table and so the SELECT fails.
50 do_test fts3shared-1.3 {
53 SELECT rowid FROM t1 WHERE t1 MATCH 'stars'
55 } {1 {database table is locked}}
57 # Verify that the first connection can commit its transaction.
59 do_test fts3shared-1.4 { sqlite3_get_autocommit db } 0
60 do_execsql_test fts3shared-1.5 { COMMIT } {}
61 do_test fts3shared-1.6 { sqlite3_get_autocommit db } 1
63 # Verify that the second connection still has an open transaction.
65 do_test fts3shared-1.6 { sqlite3_get_autocommit db2 } 0
70 sqlite3_enable_shared_cache $::enable_shared_cache