mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Add new test file fts3shared.test to test the previous change.
FossilOrigin-Name: a207f74408acb043aafd96b8e03807d8ae5d7f01
This commit is contained in:
11
manifest
11
manifest
@ -1,5 +1,5 @@
|
||||
C Have\sall\sFTS3\squeries\sobtain\sa\sread\sor\swrite\stable-lock\sat\sthe\sshared-cache\slevel\sbefore\sdoing\sanything\selse.
|
||||
D 2010-09-17T15:28:42
|
||||
C Add\snew\stest\sfile\sfts3shared.test\sto\stest\sthe\sprevious\schange.
|
||||
D 2010-09-17T16:01:09
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in c599a15d268b1db2aeadea19df2adc3bf2eb6bee
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -430,6 +430,7 @@ F test/fts3malloc.test 059592c4f37ccd30138bbf8e3e5b7982cb5c8f2e
|
||||
F test/fts3near.test 2e318ee434d32babd27c167142e2b94ddbab4844
|
||||
F test/fts3query.test 2468caf7938dbc3be2e049524320ce4faf2227b3
|
||||
F test/fts3rnd.test 707533ce943f490443ce5e696236bb1675a37635
|
||||
F test/fts3shared.test 8bb266521d7c5495c0ae522bb4d376ad5387d4a2
|
||||
F test/fts3snippet.test d0c09e76f66baaa6cd7a5d3a5e0583ede68668a7
|
||||
F test/fts4aa.test eadf85621c0a113d4c7ad3ccbf8441130e007b8f
|
||||
F test/func.test 6c5ce11e3a0021ca3c0649234e2d4454c89110ca
|
||||
@ -857,7 +858,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||
P 876845661a944ec1c841d1e2486d070efb76e5cd
|
||||
R 401b1a82d59ba178c1657b3c6769d891
|
||||
P 018e82c775d0fb8c0d90cddf7a87c20c8c8172a9
|
||||
R 23f3d639f37034f19c46e4475c50be79
|
||||
U dan
|
||||
Z abafac0893458198170055470419f700
|
||||
Z 5a6f16eca4e34587f33b9a0a6376a538
|
||||
|
@ -1 +1 @@
|
||||
018e82c775d0fb8c0d90cddf7a87c20c8c8172a9
|
||||
a207f74408acb043aafd96b8e03807d8ae5d7f01
|
72
test/fts3shared.test
Normal file
72
test/fts3shared.test
Normal file
@ -0,0 +1,72 @@
|
||||
# 2010 September 17
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
ifcapable !fts3||!shared_cache {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
db close
|
||||
set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
|
||||
|
||||
# Open two connections to the database in shared-cache mode.
|
||||
#
|
||||
sqlite3 db test.db
|
||||
sqlite3 db2 test.db
|
||||
|
||||
# Create a virtual FTS3 table. Populate it with some initial data.
|
||||
#
|
||||
do_execsql_test fts3shared-1.1 {
|
||||
CREATE VIRTUAL TABLE t1 USING fts3(x);
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES('We listened and looked sideways up!');
|
||||
INSERT INTO t1 VALUES('Fear at my heart, as at a cup,');
|
||||
INSERT INTO t1 VALUES('My life-blood seemed to sip!');
|
||||
INSERT INTO t1 VALUES('The stars were dim, and thick the night');
|
||||
COMMIT;
|
||||
} {}
|
||||
|
||||
# Open a write transaction and insert rows into the FTS3 table. This takes
|
||||
# a write-lock on the underlying t1_content table.
|
||||
#
|
||||
do_execsql_test fts3shared-1.2 {
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES('The steersman''s face by his lamp gleamed white;');
|
||||
} {}
|
||||
|
||||
# Now try a SELECT on the full-text table. This particular SELECT does not
|
||||
# read data from the %_content table. But it still attempts to obtain a lock
|
||||
# on that table and so the SELECT fails.
|
||||
#
|
||||
do_test fts3shared-1.3 {
|
||||
catchsql {
|
||||
BEGIN;
|
||||
SELECT rowid FROM t1 WHERE t1 MATCH 'stars'
|
||||
} db2
|
||||
} {1 {database table is locked}}
|
||||
|
||||
# Verify that the first connection can commit its transaction.
|
||||
#
|
||||
do_test fts3shared-1.4 { sqlite3_get_autocommit db } 0
|
||||
do_execsql_test fts3shared-1.5 { COMMIT } {}
|
||||
do_test fts3shared-1.6 { sqlite3_get_autocommit db } 1
|
||||
|
||||
# Verify that the second connection still has an open transaction.
|
||||
#
|
||||
do_test fts3shared-1.6 { sqlite3_get_autocommit db2 } 0
|
||||
|
||||
db close
|
||||
db2 close
|
||||
|
||||
sqlite3_enable_shared_cache $::enable_shared_cache
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user