OLD | NEW |
1 # 2008 April 14 | 1 # 2008 April 14 |
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 #*********************************************************************** |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 SELECT * FROM t1 | 51 SELECT * FROM t1 |
52 } | 52 } |
53 } {} | 53 } {} |
54 | 54 |
55 do_test tempdb-2.1 { | 55 do_test tempdb-2.1 { |
56 # Set $::jrnl_in_memory if the journal file is expected to be in-memory. | 56 # Set $::jrnl_in_memory if the journal file is expected to be in-memory. |
57 # Similarly, set $::subj_in_memory if the sub-journal file is expected | 57 # Similarly, set $::subj_in_memory if the sub-journal file is expected |
58 # to be in memory. These variables are used to calculate the expected | 58 # to be in memory. These variables are used to calculate the expected |
59 # number of open files in the test cases below. | 59 # number of open files in the test cases below. |
60 # | 60 # |
61 set jrnl_in_memory [expr { | 61 set jrnl_in_memory [expr {[permutation] eq "inmemory_journal"}] |
62 [info exists ::permutations_test_prefix] && | 62 set subj_in_memory [expr {$jrnl_in_memory || $TEMP_STORE>=2}] |
63 $::permutations_test_prefix eq "inmemory_journal" | |
64 }] | |
65 set subj_in_memory [expr {$jrnl_in_memory || $TEMP_STORE == 3}] | |
66 | 63 |
67 db close | 64 db close |
68 sqlite3 db test.db | 65 sqlite3 db test.db |
69 } {} | 66 } {} |
70 do_test tempdb-2.2 { | 67 do_test tempdb-2.2 { |
71 execsql { | 68 execsql { |
72 CREATE TABLE t1 (a PRIMARY KEY, b, c); | 69 CREATE TABLE t1 (a PRIMARY KEY, b, c); |
73 CREATE TABLE t2 (a, b, c); | 70 CREATE TABLE t2 (a, b, c); |
74 BEGIN; | 71 BEGIN; |
75 INSERT INTO t1 VALUES(1, 2, 3); | 72 INSERT INTO t1 VALUES(1, 2, 3); |
76 INSERT INTO t1 VALUES(4, 5, 6); | 73 INSERT INTO t1 VALUES(4, 5, 6); |
| 74 INSERT INTO t2 VALUES(7, 8, 9); |
77 INSERT INTO t2 SELECT * FROM t1; | 75 INSERT INTO t2 SELECT * FROM t1; |
78 } | 76 } |
79 catchsql { INSERT INTO t1 SELECT * FROM t2 } | 77 catchsql { INSERT INTO t1 SELECT * FROM t2 } |
80 set sqlite_open_file_count | 78 set sqlite_open_file_count |
81 } [expr 1 + (0==$jrnl_in_memory) + (0==$subj_in_memory)] | 79 } [expr 1 + (0==$jrnl_in_memory) + (0==$subj_in_memory)] |
82 do_test tempdb-2.3 { | 80 do_test tempdb-2.3 { |
83 execsql { | 81 execsql { |
84 PRAGMA temp_store = 'memory'; | 82 PRAGMA temp_store = 'memory'; |
85 ROLLBACK; | 83 ROLLBACK; |
86 BEGIN; | 84 BEGIN; |
87 INSERT INTO t1 VALUES(1, 2, 3); | 85 INSERT INTO t1 VALUES(1, 2, 3); |
88 INSERT INTO t1 VALUES(4, 5, 6); | 86 INSERT INTO t1 VALUES(4, 5, 6); |
89 INSERT INTO t2 SELECT * FROM t1; | 87 INSERT INTO t2 SELECT * FROM t1; |
90 } | 88 } |
91 catchsql { INSERT INTO t1 SELECT * FROM t2 } | 89 catchsql { INSERT INTO t1 SELECT * FROM t2 } |
92 set sqlite_open_file_count | 90 set sqlite_open_file_count |
93 } [expr 1 + (0==$jrnl_in_memory)] | 91 } [expr 1 + (0==$jrnl_in_memory)] |
94 | 92 |
95 finish_test | 93 finish_test |
OLD | NEW |