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 #***********************************************************************
11 # This file implements regression tests for SQLite library.
13 # This file implements tests to verify that ticket [f777251dc7a] has been
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
25 do_test tkt-f7772-1.1 {
27 CREATE TEMP TABLE t1(x UNIQUE);
28 INSERT INTO t1 VALUES(1);
29 CREATE TABLE t2(x, y);
30 INSERT INTO t2 VALUES(1, 2);
31 CREATE TEMP TABLE t3(w, z);
35 proc force_rollback {} {
36 catch {db eval {INSERT OR ROLLBACK INTO t1 VALUES(1)}}
38 db function force_rollback force_rollback
40 do_test tkt-f7772-1.2 {
43 CREATE TABLE xyzzy(abc);
44 SELECT x, force_rollback(), EXISTS(SELECT 1 FROM t3 WHERE w=x) FROM t2;
46 } {1 {abort due to ROLLBACK}}
47 do_test tkt-f7772-1.3 {
48 sqlite3_get_autocommit db
51 do_test tkt-f7772-2.1 {
53 DROP TABLE IF EXISTS t1;
54 DROP TABLE IF EXISTS t2;
55 DROP TABLE IF EXISTS t3;
57 CREATE TEMP TABLE t1(x UNIQUE);
58 INSERT INTO t1 VALUES(1);
59 CREATE TABLE t2(x, y);
60 INSERT INTO t2 VALUES(1, 2);
63 do_test tkt-f7772-2.2 {
66 CREATE TEMP TABLE t3(w, z);
69 SELECT x, force_rollback(), EXISTS(SELECT 1 FROM t3 WHERE w=x) FROM t2
71 } {1 {abort due to ROLLBACK}}
72 do_test tkt-f7772-2.3 {
73 sqlite3_get_autocommit db
76 do_test tkt-f7772-3.1 {
78 DROP TABLE IF EXISTS t1;
79 DROP TABLE IF EXISTS t2;
80 DROP TABLE IF EXISTS t3;
82 CREATE TEMP TABLE t1(x);
86 INSERT INTO t1 VALUES(1);
87 INSERT INTO t1 VALUES(2);
88 INSERT INTO t2 VALUES(1);
89 INSERT INTO t2 VALUES(2);
93 proc ins {} { db eval {INSERT INTO t3 VALUES('hello')} }
96 do_test tkt-f7772-3.2 {
98 SELECT ins() AS x FROM t2 UNION ALL SELECT ins() AS x FROM t1
101 do_test tkt-f7772-3.3 {
102 execsql { SELECT * FROM t3 }
103 } {hello hello hello hello}