| OLD | NEW |
| 1 # 2005 January 19 | 1 # 2005 January 19 |
| 2 # | 2 # |
| 3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
| 4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
| 5 # | 5 # |
| 6 # May you do good and not evil. | 6 # May you do good and not evil. |
| 7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
| 8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
| 9 # | 9 # |
| 10 #*********************************************************************** | 10 #*********************************************************************** |
| 11 # | 11 # |
| 12 # $Id: shared3.test,v 1.4 2008/08/20 14:49:25 danielk1977 Exp $ | 12 # $Id: shared3.test,v 1.4 2008/08/20 14:49:25 danielk1977 Exp $ |
| 13 | 13 |
| 14 set testdir [file dirname $argv0] | 14 set testdir [file dirname $argv0] |
| 15 source $testdir/tester.tcl | 15 source $testdir/tester.tcl |
| 16 set testprefix shared3 |
| 16 db close | 17 db close |
| 17 | 18 |
| 18 ifcapable !shared_cache { | 19 ifcapable !shared_cache { |
| 19 finish_test | 20 finish_test |
| 20 return | 21 return |
| 21 } | 22 } |
| 22 set ::enable_shared_cache [sqlite3_enable_shared_cache 1] | 23 set ::enable_shared_cache [sqlite3_enable_shared_cache 1] |
| 23 | 24 |
| 24 # Ticket #1824 | 25 # Ticket #1824 |
| 25 # | 26 # |
| 26 do_test shared3-1.1 { | 27 do_test shared3-1.1 { |
| 27 file delete -force test.db test.db-journal | 28 forcedelete test.db test.db-journal |
| 28 sqlite3 db1 test.db | 29 sqlite3 db1 test.db |
| 29 db1 eval { | 30 db1 eval { |
| 30 PRAGMA encoding=UTF16; | 31 PRAGMA encoding=UTF16; |
| 31 CREATE TABLE t1(x,y); | 32 CREATE TABLE t1(x,y); |
| 32 INSERT INTO t1 VALUES('abc','This is a test string'); | 33 INSERT INTO t1 VALUES('abc','This is a test string'); |
| 33 } | 34 } |
| 34 db1 close | 35 db1 close |
| 35 sqlite3 db1 test.db | 36 sqlite3 db1 test.db |
| 36 db1 eval {SELECT * FROM t1} | 37 db1 eval {SELECT * FROM t1} |
| 37 } {abc {This is a test string}} | 38 } {abc {This is a test string}} |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 # on the database file so that the cache could be spilled. | 97 # on the database file so that the cache could be spilled. |
| 97 # | 98 # |
| 98 catch { sqlite3 db3 $alternative_name } | 99 catch { sqlite3 db3 $alternative_name } |
| 99 catchsql {select count(*) from sqlite_master} db3 | 100 catchsql {select count(*) from sqlite_master} db3 |
| 100 } {1 {database is locked}} | 101 } {1 {database is locked}} |
| 101 | 102 |
| 102 db1 close | 103 db1 close |
| 103 db2 close | 104 db2 close |
| 104 db3 close | 105 db3 close |
| 105 | 106 |
| 107 #------------------------------------------------------------------------- |
| 108 # At one point this was causing a faulty assert to fail. |
| 109 # |
| 110 forcedelete test.db |
| 111 sqlite3 db test.db |
| 112 sqlite3 db2 test.db |
| 113 do_execsql_test 3.1 { |
| 114 PRAGMA auto_vacuum = 2; |
| 115 CREATE TABLE t1(x, y); |
| 116 INSERT INTO t1 VALUES(randomblob(500), randomblob(500)); |
| 117 INSERT INTO t1 SELECT randomblob(500), randomblob(500) FROM t1; |
| 118 INSERT INTO t1 SELECT randomblob(500), randomblob(500) FROM t1; |
| 119 INSERT INTO t1 SELECT randomblob(500), randomblob(500) FROM t1; |
| 120 INSERT INTO t1 SELECT randomblob(500), randomblob(500) FROM t1; |
| 121 INSERT INTO t1 SELECT randomblob(500), randomblob(500) FROM t1; |
| 122 INSERT INTO t1 SELECT randomblob(500), randomblob(500) FROM t1; |
| 123 INSERT INTO t1 SELECT randomblob(500), randomblob(500) FROM t1; |
| 124 } |
| 125 do_test 3.2 { |
| 126 execsql { SELECT count(*) FROM sqlite_master } db2 |
| 127 } {1} |
| 128 do_execsql_test 3.3 { |
| 129 BEGIN; |
| 130 DELETE FROM t1 WHERE 1; |
| 131 PRAGMA incremental_vacuum; |
| 132 } {} |
| 133 do_test 3.4 { |
| 134 execsql { SELECT count(*) FROM sqlite_master } db2 |
| 135 } {1} |
| 136 do_test 3.5 { |
| 137 execsql { COMMIT } |
| 138 } {} |
| 139 |
| 106 sqlite3_enable_shared_cache $::enable_shared_cache | 140 sqlite3_enable_shared_cache $::enable_shared_cache |
| 107 finish_test | 141 finish_test |
| 142 |
| OLD | NEW |