OLD | NEW |
1 # 2008 December 15 | 1 # 2008 December 15 |
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 #*********************************************************************** |
11 # | 11 # |
12 # $Id: savepoint2.test,v 1.5 2009/06/05 17:09:12 drh Exp $ | 12 # $Id: savepoint2.test,v 1.5 2009/06/05 17:09:12 drh Exp $ |
13 | 13 |
14 set testdir [file dirname $argv0] | 14 set testdir [file dirname $argv0] |
15 source $testdir/tester.tcl | 15 source $testdir/tester.tcl |
16 | 16 |
| 17 |
17 # Tests in this file are quite similar to those run by trans.test and | 18 # Tests in this file are quite similar to those run by trans.test and |
18 # avtrans.test. | 19 # avtrans.test. |
19 # | 20 # |
20 | 21 |
21 proc signature {} { | 22 proc signature {} { |
22 return [db eval {SELECT count(*), md5sum(x) FROM t3}] | 23 return [db eval {SELECT count(*), md5sum(x) FROM t3}] |
23 } | 24 } |
24 | 25 |
25 do_test savepoint2-1 { | 26 do_test savepoint2-1 { |
| 27 wal_set_journal_mode |
26 execsql { | 28 execsql { |
27 PRAGMA cache_size=10; | 29 PRAGMA cache_size=10; |
28 BEGIN; | 30 BEGIN; |
29 CREATE TABLE t3(x TEXT); | 31 CREATE TABLE t3(x TEXT); |
30 INSERT INTO t3 VALUES(randstr(10,400)); | 32 INSERT INTO t3 VALUES(randstr(10,400)); |
31 INSERT INTO t3 VALUES(randstr(10,400)); | 33 INSERT INTO t3 VALUES(randstr(10,400)); |
32 INSERT INTO t3 SELECT randstr(10,400) FROM t3; | 34 INSERT INTO t3 SELECT randstr(10,400) FROM t3; |
33 INSERT INTO t3 SELECT randstr(10,400) FROM t3; | 35 INSERT INTO t3 SELECT randstr(10,400) FROM t3; |
34 INSERT INTO t3 SELECT randstr(10,400) FROM t3; | 36 INSERT INTO t3 SELECT randstr(10,400) FROM t3; |
35 INSERT INTO t3 SELECT randstr(10,400) FROM t3; | 37 INSERT INTO t3 SELECT randstr(10,400) FROM t3; |
36 INSERT INTO t3 SELECT randstr(10,400) FROM t3; | 38 INSERT INTO t3 SELECT randstr(10,400) FROM t3; |
37 INSERT INTO t3 SELECT randstr(10,400) FROM t3; | 39 INSERT INTO t3 SELECT randstr(10,400) FROM t3; |
38 INSERT INTO t3 SELECT randstr(10,400) FROM t3; | 40 INSERT INTO t3 SELECT randstr(10,400) FROM t3; |
39 INSERT INTO t3 SELECT randstr(10,400) FROM t3; | 41 INSERT INTO t3 SELECT randstr(10,400) FROM t3; |
40 INSERT INTO t3 SELECT randstr(10,400) FROM t3; | 42 INSERT INTO t3 SELECT randstr(10,400) FROM t3; |
41 COMMIT; | 43 COMMIT; |
42 SELECT count(*) FROM t3; | 44 SELECT count(*) FROM t3; |
43 } | 45 } |
44 } {1024} | 46 } {1024} |
| 47 wal_check_journal_mode savepoint2-1.1 |
45 | 48 |
46 unset -nocomplain ::sig | 49 unset -nocomplain ::sig |
47 unset -nocomplain SQL | 50 unset -nocomplain SQL |
48 | 51 |
49 set iterations 20 | 52 set iterations 20 |
50 | 53 |
51 set SQL(1) { | 54 set SQL(1) { |
52 DELETE FROM t3 WHERE random()%10!=0; | 55 DELETE FROM t3 WHERE random()%10!=0; |
53 INSERT INTO t3 SELECT randstr(10,10)||x FROM t3; | 56 INSERT INTO t3 SELECT randstr(10,10)||x FROM t3; |
54 INSERT INTO t3 SELECT randstr(10,10)||x FROM t3; | 57 INSERT INTO t3 SELECT randstr(10,10)||x FROM t3; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 # The transaction being committed here may have been opened normally using | 136 # The transaction being committed here may have been opened normally using |
134 # "BEGIN", or may have been opened using a transaction savepoint created | 137 # "BEGIN", or may have been opened using a transaction savepoint created |
135 # by the "SAVEPOINT one" statement. | 138 # by the "SAVEPOINT one" statement. |
136 # | 139 # |
137 do_test savepoint2-$ii.6 { | 140 do_test savepoint2-$ii.6 { |
138 execsql $SQL(4) | 141 execsql $SQL(4) |
139 execsql COMMIT | 142 execsql COMMIT |
140 sqlite3_get_autocommit db | 143 sqlite3_get_autocommit db |
141 } {1} | 144 } {1} |
142 integrity_check savepoint2-$ii.6.1 | 145 integrity_check savepoint2-$ii.6.1 |
| 146 |
| 147 # Check that the connection is still running in WAL mode. |
| 148 wal_check_journal_mode savepoint2-$ii.7 |
143 } | 149 } |
144 | 150 |
145 unset -nocomplain ::sig | 151 unset -nocomplain ::sig |
146 unset -nocomplain SQL | 152 unset -nocomplain SQL |
147 | 153 |
148 finish_test | 154 finish_test |
OLD | NEW |