blob: fe50d22b54ee89d8a3ccc472d77f4b9c6373a4a7 [file] [log] [blame]
drhf012ea32006-05-24 12:43:26 +00001# 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#
danielk19779324c8f2008-06-20 17:51:16 +000012# $Id: shared3.test,v 1.2 2008/06/20 17:51:17 danielk1977 Exp $
drhf012ea32006-05-24 12:43:26 +000013
14set testdir [file dirname $argv0]
15source $testdir/tester.tcl
16db close
17
18ifcapable !shared_cache {
19 finish_test
20 return
21}
22set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
23
24# Ticket #1824
25#
26do_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}}
38do_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
43db1 close
44db2 close
45
danielk19779324c8f2008-06-20 17:51:16 +000046do_test shared3-2.1 {
47 sqlite3 db1 test.db
48 execsql {
49 PRAGMA main.cache_size = 64;
50 } db1
51} {}
52do_test shared3-2.2 {
53 execsql { PRAGMA main.cache_size } db1
54} {64}
55do_test shared3-2.3 {
56 sqlite3 db2 test.db
57 execsql { PRAGMA main.cache_size } db1
58} {64}
59do_test shared3-2.4 {
60 execsql { PRAGMA main.cache_size } db2
61} {64}
62do_test shared3-2.5 {
63 execsql { PRAGMA main.cache_size } db1
64} {64}
65
66db1 close
67db2 close
68
drhf012ea32006-05-24 12:43:26 +000069sqlite3_enable_shared_cache $::enable_shared_cache
70finish_test