wasCSharpSQLite – Blame information for rev 7
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | # 2010 July 29 |
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 | # |
||
12 | |||
13 | set testdir [file dirname $argv0] |
||
14 | source $testdir/tester.tcl |
||
15 | source $testdir/malloc_common.tcl |
||
16 | |||
17 | foreach f [glob -nocomplain test.db*mj*] { file delete -force $f } |
||
18 | file delete -force test.db2 |
||
19 | |||
20 | do_test tkt-f3e5abed55-1.1 { |
||
21 | execsql { |
||
22 | ATTACH 'test.db2' AS aux; |
||
23 | CREATE TABLE main.t1(a, b); |
||
24 | CREATE TABLE aux.t2(c, d); |
||
25 | } |
||
26 | } {} |
||
27 | |||
28 | do_test tkt-f3e5abed55-1.2 { |
||
29 | glob -nocomplain test.db*mj* |
||
30 | } {} |
||
31 | |||
32 | do_test tkt-f3e5abed55-1.3 { |
||
33 | sqlite3 db2 test.db |
||
34 | execsql { BEGIN; SELECT * FROM t1 } db2 |
||
35 | } {} |
||
36 | |||
37 | do_test tkt-f3e5abed55-1.4 { |
||
38 | execsql { |
||
39 | BEGIN; |
||
40 | INSERT INTO t1 VALUES(1, 2); |
||
41 | INSERT INTO t2 VALUES(1, 2); |
||
42 | } |
||
43 | catchsql COMMIT |
||
44 | } {1 {database is locked}} |
||
45 | |||
46 | do_test tkt-f3e5abed55-1.5 { |
||
47 | execsql COMMIT db2 |
||
48 | execsql COMMIT |
||
49 | } {} |
||
50 | |||
51 | do_test tkt-f3e5abed55-1.6 { |
||
52 | glob -nocomplain test.db*mj* |
||
53 | } {} |
||
54 | foreach f [glob -nocomplain test.db*mj*] { file delete -force $f } |
||
55 | db close |
||
56 | db2 close |
||
57 | |||
58 | |||
59 | |||
60 | # Set up a testvfs so that the next time SQLite tries to delete the |
||
61 | # file "test.db-journal", a snapshot of the current file-system contents |
||
62 | # is taken. |
||
63 | # |
||
64 | # This test will not work with an in-memory journal. |
||
65 | # |
||
66 | if {[permutation]!="inmemory_journal"} { |
||
67 | testvfs tvfs -default 1 |
||
68 | tvfs script xDelete |
||
69 | tvfs filter xDelete |
||
70 | proc xDelete {method file args} { |
||
71 | if {[file tail $file] == "test.db-journal"} { |
||
72 | faultsim_save |
||
73 | tvfs filter {} |
||
74 | } |
||
75 | return "SQLITE_OK" |
||
76 | } |
||
77 | |||
78 | sqlite3 db test.db |
||
79 | sqlite3 db2 test.db |
||
80 | do_test tkt-f3e5abed55-2.1 { |
||
81 | execsql { |
||
82 | ATTACH 'test.db2' AS aux; |
||
83 | BEGIN; |
||
84 | INSERT INTO t1 VALUES(3, 4); |
||
85 | INSERT INTO t2 VALUES(3, 4); |
||
86 | } |
||
87 | } {} |
||
88 | do_test tkt-f3e5abed55-2.2 { |
||
89 | execsql { BEGIN; SELECT * FROM t1 } db2 |
||
90 | } {1 2} |
||
91 | do_test tkt-f3e5abed55-2.3 { |
||
92 | catchsql COMMIT |
||
93 | } {1 {database is locked}} |
||
94 | |||
95 | do_test tkt-f3e5abed55-2.4 { |
||
96 | execsql COMMIT db2 |
||
97 | execsql { |
||
98 | COMMIT; |
||
99 | SELECT * FROM t1; |
||
100 | SELECT * FROM t2; |
||
101 | } |
||
102 | } {1 2 3 4 1 2 3 4} |
||
103 | do_test tkt-f3e5abed55-2.5 { |
||
104 | db close |
||
105 | db2 close |
||
106 | faultsim_restore_and_reopen |
||
107 | execsql { |
||
108 | ATTACH 'test.db2' AS aux; |
||
109 | SELECT * FROM t1; |
||
110 | SELECT * FROM t2; |
||
111 | } |
||
112 | } {1 2 3 4 1 2 3 4} |
||
113 | } |
||
114 | |||
115 | |||
116 | finish_test |
||
117 |