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
20 do_test tkt-f7772-1.1 {
22 CREATE TEMP TABLE t1(x UNIQUE);
23 INSERT INTO t1 VALUES(1);
24 CREATE TABLE t2(x, y);
25 INSERT INTO t2 VALUES(1, 2);
26 CREATE TEMP TABLE t3(w, z);
30 proc force_rollback {} {
31 catch {db eval {INSERT OR ROLLBACK INTO t1 VALUES(1)}}
33 db function force_rollback force_rollback
35 do_test tkt-f7772-1.2 {
38 SELECT x, force_rollback(), EXISTS(SELECT 1 FROM t3 WHERE w=x) FROM t2;
40 } {1 {callback requested query abort}}
41 do_test tkt-f7772-1.3 {
42 sqlite3_get_autocommit db
45 do_test tkt-f7772-2.1 {
47 DROP TABLE IF EXISTS t1;
48 DROP TABLE IF EXISTS t2;
49 DROP TABLE IF EXISTS t3;
51 CREATE TEMP TABLE t1(x UNIQUE);
52 INSERT INTO t1 VALUES(1);
53 CREATE TABLE t2(x, y);
54 INSERT INTO t2 VALUES(1, 2);
57 do_test tkt-f7772-2.2 {
60 CREATE TEMP TABLE t3(w, z);
63 SELECT x, force_rollback(), EXISTS(SELECT 1 FROM t3 WHERE w=x) FROM t2
65 } {1 {callback requested query abort}}
66 do_test tkt-f7772-2.3 {
67 sqlite3_get_autocommit db
70 do_test tkt-f7772-3.1 {
72 DROP TABLE IF EXISTS t1;
73 DROP TABLE IF EXISTS t2;
74 DROP TABLE IF EXISTS t3;
76 CREATE TEMP TABLE t1(x);
80 INSERT INTO t1 VALUES(1);
81 INSERT INTO t1 VALUES(2);
82 INSERT INTO t2 VALUES(1);
83 INSERT INTO t2 VALUES(2);
87 proc ins {} { db eval {INSERT INTO t3 VALUES('hello')} }
90 do_test tkt-f7772-3.2 {
92 SELECT ins() AS x FROM t2 UNION ALL SELECT ins() AS x FROM t1
95 do_test tkt-f7772-3.3 {
96 execsql { SELECT * FROM t3 }
97 } {hello hello hello hello}