3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
13 set testdir [file dirname $argv0]
14 source $testdir/tester.tcl
15 source $testdir/malloc_common.tcl
16 source $testdir/lock_common.tcl
19 do_multiclient_test tn {
20 code1 { catch { sqlite3_multiplex_initialize "" 0 } }
21 code2 { catch { sqlite3_multiplex_initialize "" 0 } }
26 code1 { sqlite3 db test.db -vfs multiplex }
27 code2 { sqlite3 db2 test.db -vfs multiplex }
29 code1 { sqlite3_multiplex_control db main chunk_size [expr 1024*1024] }
30 code2 { sqlite3_multiplex_control db2 main chunk_size [expr 1024*1024] }
33 CREATE TABLE t1(a, b);
34 INSERT INTO t1 VALUES(randomblob(10), randomblob(4000)); -- 1
35 INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1; -- 2
36 INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1; -- 4
37 INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1; -- 8
38 INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1; -- 16
39 INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1; -- 32
40 INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1; -- 64
41 INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1; -- 128
42 INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1; -- 256
43 INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1; -- 512
44 SELECT count(*) FROM t1;
47 do_test multiplex-1.$tn.1 { sql1 { SELECT count(*) FROM t1 } } 512
48 do_test multiplex-1.$tn.2 { sql2 { SELECT count(*) FROM t1 } } 512
49 sql2 { DELETE FROM t1 ; VACUUM }
50 do_test multiplex-1.$tn.3 { sql1 { SELECT count(*) FROM t1 } } 0
53 INSERT INTO t1 VALUES(randomblob(10), randomblob(4000)); -- 1
54 INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1; -- 2
55 INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1; -- 4
56 INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1; -- 8
57 INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1; -- 16
58 INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1; -- 32
59 INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1; -- 64
60 INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1; -- 128
61 INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1; -- 256
62 INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1; -- 512
63 SELECT count(*) FROM t1;
66 do_test multiplex-1.$tn.4 { sql2 { SELECT count(*) FROM t1 } } 512
69 catch { sqlite3_multiplex_shutdown }