drh | f012ea3 | 2006-05-24 12:43:26 +0000 | [diff] [blame] | 1 | # 2005 January 19 |
| 2 | # |
| 3 | # The author disclaims copyright to this source code. In place of |
| 4 | # a legal notice, here is a blessing: |
| 5 | # |
| 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. |
| 9 | # |
| 10 | #*********************************************************************** |
| 11 | # |
danielk1977 | 9324c8f | 2008-06-20 17:51:16 +0000 | [diff] [blame^] | 12 | # $Id: shared3.test,v 1.2 2008/06/20 17:51:17 danielk1977 Exp $ |
drh | f012ea3 | 2006-05-24 12:43:26 +0000 | [diff] [blame] | 13 | |
| 14 | set testdir [file dirname $argv0] |
| 15 | source $testdir/tester.tcl |
| 16 | db close |
| 17 | |
| 18 | ifcapable !shared_cache { |
| 19 | finish_test |
| 20 | return |
| 21 | } |
| 22 | set ::enable_shared_cache [sqlite3_enable_shared_cache 1] |
| 23 | |
| 24 | # Ticket #1824 |
| 25 | # |
| 26 | do_test shared3-1.1 { |
| 27 | file delete -force test.db test.db-journal |
| 28 | sqlite3 db1 test.db |
| 29 | db1 eval { |
| 30 | PRAGMA encoding=UTF16; |
| 31 | CREATE TABLE t1(x,y); |
| 32 | INSERT INTO t1 VALUES('abc','This is a test string'); |
| 33 | } |
| 34 | db1 close |
| 35 | sqlite3 db1 test.db |
| 36 | db1 eval {SELECT * FROM t1} |
| 37 | } {abc {This is a test string}} |
| 38 | do_test shared3-1.2 { |
| 39 | sqlite3 db2 test.db |
| 40 | db2 eval {SELECT y FROM t1 WHERE x='abc'} |
| 41 | } {{This is a test string}} |
| 42 | |
| 43 | db1 close |
| 44 | db2 close |
| 45 | |
danielk1977 | 9324c8f | 2008-06-20 17:51:16 +0000 | [diff] [blame^] | 46 | do_test shared3-2.1 { |
| 47 | sqlite3 db1 test.db |
| 48 | execsql { |
| 49 | PRAGMA main.cache_size = 64; |
| 50 | } db1 |
| 51 | } {} |
| 52 | do_test shared3-2.2 { |
| 53 | execsql { PRAGMA main.cache_size } db1 |
| 54 | } {64} |
| 55 | do_test shared3-2.3 { |
| 56 | sqlite3 db2 test.db |
| 57 | execsql { PRAGMA main.cache_size } db1 |
| 58 | } {64} |
| 59 | do_test shared3-2.4 { |
| 60 | execsql { PRAGMA main.cache_size } db2 |
| 61 | } {64} |
| 62 | do_test shared3-2.5 { |
| 63 | execsql { PRAGMA main.cache_size } db1 |
| 64 | } {64} |
| 65 | |
| 66 | db1 close |
| 67 | db2 close |
| 68 | |
drh | f012ea3 | 2006-05-24 12:43:26 +0000 | [diff] [blame] | 69 | sqlite3_enable_shared_cache $::enable_shared_cache |
| 70 | finish_test |