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. The
12 # focus of this file is verifying that a rollback in one statement
13 # caused by an ON CONFLICT ROLLBACK clause aborts any other pending
16 # $Id: rollback.test,v 1.2 2005/01/12 13:04:55 danielk1977 Exp $
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
22 set DB [sqlite3 db test.db]
24 do_test rollback-1.1 {
27 INSERT INTO t1 VALUES(1);
28 INSERT INTO t1 VALUES(2);
29 INSERT INTO t1 VALUES(3);
30 INSERT INTO t1 VALUES(4);
35 do_test rollback-1.2 {
37 CREATE TABLE t3(a unique on conflict rollback);
38 INSERT INTO t3 SELECT a FROM t1;
40 INSERT INTO t1 SELECT * FROM t1;
43 do_test rollback-1.3 {
44 set STMT [sqlite3_prepare $DB "SELECT a FROM t1" -1 TAIL]
48 # This causes a ROLLBACK, which deletes the table out from underneath the
51 do_test rollback-1.4 {
53 INSERT INTO t3 SELECT a FROM t1;
55 } {1 {column a is not unique}}
57 # Try to continue with the SELECT statement
59 do_test rollback-1.5 {
63 # Restart the SELECT statement
65 do_test rollback-1.6 {
68 do_test rollback-1.7 {
71 do_test rollback-1.8 {
74 do_test rollback-1.9 {
75 sqlite3_finalize $STMT