OLD | NEW |
1 # 2009 October 16 | 1 # 2009 October 16 |
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 # This file implements regression tests for SQLite library. | 11 # This file implements regression tests for SQLite library. |
12 # | 12 # |
13 # This file implements tests to verify that ticket [f777251dc7a] has been | 13 # This file implements tests to verify that ticket [f777251dc7a] has been |
14 # fixed. | 14 # fixed. |
15 # | 15 # |
16 | 16 |
17 set testdir [file dirname $argv0] | 17 set testdir [file dirname $argv0] |
18 source $testdir/tester.tcl | 18 source $testdir/tester.tcl |
19 | 19 |
| 20 ifcapable !compound { |
| 21 finish_test |
| 22 return |
| 23 } |
| 24 |
20 do_test tkt-f7772-1.1 { | 25 do_test tkt-f7772-1.1 { |
21 execsql { | 26 execsql { |
22 CREATE TEMP TABLE t1(x UNIQUE); | 27 CREATE TEMP TABLE t1(x UNIQUE); |
23 INSERT INTO t1 VALUES(1); | 28 INSERT INTO t1 VALUES(1); |
24 CREATE TABLE t2(x, y); | 29 CREATE TABLE t2(x, y); |
25 INSERT INTO t2 VALUES(1, 2); | 30 INSERT INTO t2 VALUES(1, 2); |
26 CREATE TEMP TABLE t3(w, z); | 31 CREATE TEMP TABLE t3(w, z); |
27 } | 32 } |
28 } {} | 33 } {} |
29 | 34 |
30 proc force_rollback {} { | 35 proc force_rollback {} { |
31 catch {db eval {INSERT OR ROLLBACK INTO t1 VALUES(1)}} | 36 catch {db eval {INSERT OR ROLLBACK INTO t1 VALUES(1)}} |
32 } | 37 } |
33 db function force_rollback force_rollback | 38 db function force_rollback force_rollback |
34 | 39 |
35 do_test tkt-f7772-1.2 { | 40 do_test tkt-f7772-1.2 { |
| 41 breakpoint |
36 catchsql { | 42 catchsql { |
37 BEGIN IMMEDIATE; | 43 BEGIN IMMEDIATE; |
| 44 CREATE TABLE xyzzy(abc); |
38 SELECT x, force_rollback(), EXISTS(SELECT 1 FROM t3 WHERE w=x) FROM t2; | 45 SELECT x, force_rollback(), EXISTS(SELECT 1 FROM t3 WHERE w=x) FROM t2; |
39 } | 46 } |
40 } {1 {callback requested query abort}} | 47 } {1 {abort due to ROLLBACK}} |
41 do_test tkt-f7772-1.3 { | 48 do_test tkt-f7772-1.3 { |
42 sqlite3_get_autocommit db | 49 sqlite3_get_autocommit db |
43 } {1} | 50 } {1} |
44 | 51 |
45 do_test tkt-f7772-2.1 { | 52 do_test tkt-f7772-2.1 { |
46 execsql { | 53 execsql { |
47 DROP TABLE IF EXISTS t1; | 54 DROP TABLE IF EXISTS t1; |
48 DROP TABLE IF EXISTS t2; | 55 DROP TABLE IF EXISTS t2; |
49 DROP TABLE IF EXISTS t3; | 56 DROP TABLE IF EXISTS t3; |
50 | 57 |
51 CREATE TEMP TABLE t1(x UNIQUE); | 58 CREATE TEMP TABLE t1(x UNIQUE); |
52 INSERT INTO t1 VALUES(1); | 59 INSERT INTO t1 VALUES(1); |
53 CREATE TABLE t2(x, y); | 60 CREATE TABLE t2(x, y); |
54 INSERT INTO t2 VALUES(1, 2); | 61 INSERT INTO t2 VALUES(1, 2); |
55 } | 62 } |
56 } {} | 63 } {} |
57 do_test tkt-f7772-2.2 { | 64 do_test tkt-f7772-2.2 { |
58 execsql { | 65 execsql { |
59 BEGIN IMMEDIATE; | 66 BEGIN IMMEDIATE; |
60 CREATE TEMP TABLE t3(w, z); | 67 CREATE TEMP TABLE t3(w, z); |
61 } | 68 } |
62 catchsql { | 69 catchsql { |
63 SELECT x, force_rollback(), EXISTS(SELECT 1 FROM t3 WHERE w=x) FROM t2 | 70 SELECT x, force_rollback(), EXISTS(SELECT 1 FROM t3 WHERE w=x) FROM t2 |
64 } | 71 } |
65 } {1 {callback requested query abort}} | 72 } {1 {abort due to ROLLBACK}} |
66 do_test tkt-f7772-2.3 { | 73 do_test tkt-f7772-2.3 { |
67 sqlite3_get_autocommit db | 74 sqlite3_get_autocommit db |
68 } {1} | 75 } {1} |
69 | 76 |
70 do_test tkt-f7772-3.1 { | 77 do_test tkt-f7772-3.1 { |
71 execsql { | 78 execsql { |
72 DROP TABLE IF EXISTS t1; | 79 DROP TABLE IF EXISTS t1; |
73 DROP TABLE IF EXISTS t2; | 80 DROP TABLE IF EXISTS t2; |
74 DROP TABLE IF EXISTS t3; | 81 DROP TABLE IF EXISTS t3; |
75 | 82 |
(...skipping 14 matching lines...) Expand all Loading... |
90 do_test tkt-f7772-3.2 { | 97 do_test tkt-f7772-3.2 { |
91 execsql { | 98 execsql { |
92 SELECT ins() AS x FROM t2 UNION ALL SELECT ins() AS x FROM t1 | 99 SELECT ins() AS x FROM t2 UNION ALL SELECT ins() AS x FROM t1 |
93 } | 100 } |
94 } {{} {} {} {}} | 101 } {{} {} {} {}} |
95 do_test tkt-f7772-3.3 { | 102 do_test tkt-f7772-3.3 { |
96 execsql { SELECT * FROM t3 } | 103 execsql { SELECT * FROM t3 } |
97 } {hello hello hello hello} | 104 } {hello hello hello hello} |
98 | 105 |
99 finish_test | 106 finish_test |
OLD | NEW |