Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add a test for the collation-sequence/CHECK constraint problem fixed by the previous commit. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | shared-cache-fix |
Files: | files | file ages | folders |
SHA1: |
82b6aa77c8d8de4c6fad1960f5958457 |
User & Date: | dan 2012-10-05 17:18:16.288 |
Context
2012-10-05
| ||
17:44 | Merge the shared-cache related fixes from the shared-cache-fix branch to the trunk. (check-in: 698ec7769d user: dan tags: trunk) | |
17:18 | Add a test for the collation-sequence/CHECK constraint problem fixed by the previous commit. (Closed-Leaf check-in: 82b6aa77c8 user: dan tags: shared-cache-fix) | |
16:30 | Fix a problem with shared-cache mode and CHECK constraints causing one db handle to invoke a collation sequence function registered with another. (check-in: c2c776ab73 user: dan tags: shared-cache-fix) | |
Changes
Changes to test/shared9.test.
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 | # to the same shared cache using different database names, views and # virtual tables may still be accessed. # set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix shared9 db close set enable_shared_cache [sqlite3_enable_shared_cache 1] | > > > > > > < < < < < < | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | # to the same shared cache using different database names, views and # virtual tables may still be accessed. # set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix shared9 ifcapable !view||!trigger { finish_test return } db close set enable_shared_cache [sqlite3_enable_shared_cache 1] sqlite3 db1 test.db sqlite3 db2 test.db forcedelete test.db2 do_test 1.1 { db1 eval { ATTACH 'test.db2' AS 'fred'; |
︙ | ︙ | |||
44 45 46 47 48 49 50 | END; INSERT INTO t2 VALUES(1, 2); SELECT * FROM t3; } } {1 2} do_test 1.2 { db2 eval "ATTACH 'test.db2' AS 'jones'" } {} | | | > | | | | | | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | END; INSERT INTO t2 VALUES(1, 2); SELECT * FROM t3; } } {1 2} do_test 1.2 { db2 eval "ATTACH 'test.db2' AS 'jones'" } {} do_test 1.3 { db2 eval "SELECT * FROM v1" } {} do_test 1.4 { db2 eval "INSERT INTO t2 VALUES(3, 4)" } {} ifcapable fts3 { do_test 1.5 { db1 eval { CREATE VIRTUAL TABLE fred.t4 USING fts4; INSERT INTO t4 VALUES('hello world'); } } {} do_test 1.6 { db2 eval { INSERT INTO t4 VALUES('shared cache'); SELECT * FROM t4 WHERE t4 MATCH 'hello'; } } {{hello world}} do_test 1.7 { db1 eval { SELECT * FROM t4 WHERE t4 MATCH 'c*'; } } {{shared cache}} } db1 close db2 close #------------------------------------------------------------------------- # The following tests attempt to find a similar problem with collation # sequence names - pointers to database handle specific allocations leaking # into schema objects and being used after the original handle has been # closed. # forcedelete test.db test.db2 sqlite3 db1 test.db sqlite3 db2 test.db foreach x {collate1 collate2 collate3} { proc $x {a b} { string compare $a $b } db1 collate $x $x db2 collate $x $x } do_test 2.1 { db1 eval { CREATE TABLE t1(a, b, c COLLATE collate1); CREATE INDEX i1 ON t1(a COLLATE collate2, c, b); } } {} do_test 2.2 { db1 close db2 eval "INSERT INTO t1 VALUES('abc', 'def', 'ghi')" } {} db2 close #------------------------------------------------------------------------- # At one point, the following would cause a collation sequence belonging # to connection [db1] to be invoked by a call to [db2 eval]. Which is a # problem if [db1] has already been closed. # forcedelete test.db test.db2 sqlite3 db1 test.db sqlite3 db2 test.db proc mycollate_db1 {a b} {set ::invoked_mycollate_db1 1 ; string compare $a $b} proc mycollate_db2 {a b} {string compare $a $b} db1 collate mycollate mycollate_db1 db2 collate mycollate mycollate_db2 do_test 2.3 { set ::invoked_mycollate_db1 0 db1 eval { CREATE TABLE t1(a COLLATE mycollate, CHECK (a IN ('one', 'two', 'three'))); INSERT INTO t1 VALUES('one'); } db1 close set ::invoked_mycollate_db1 } {1} do_test 2.4 { set ::invoked_mycollate_db1 0 db2 eval { INSERT INTO t1 VALUES('two'); } db2 close set ::invoked_mycollate_db1 } {0} sqlite3_enable_shared_cache $::enable_shared_cache finish_test |