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 #***********************************************************************
12 # This file implements regression tests for SQLite library. The
13 # focus of this script is the response of COMMIT and ROLLBACK when
14 # statements are still pending.
16 # $Id: trans3.test,v 1.2 2008/11/05 16:37:35 drh Exp $
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
20 unset -nocomplain ecode
25 INSERT INTO t1 VALUES(1);
26 INSERT INTO t1 VALUES(2);
27 INSERT INTO t1 VALUES(3);
33 db eval {INSERT INTO t1 VALUES(4);}
36 db eval {SELECT * FROM t1 LIMIT 1} {
37 if {[catch {db eval COMMIT} errmsg]} {
38 set ::ecode [sqlite3_extended_errcode db]
48 do_test trans3-1.3.1 {
49 sqlite3_get_autocommit db
52 db eval {SELECT * FROM t1}
55 db eval {BEGIN; CREATE TABLE xyzzy(abc);}
56 db eval {INSERT INTO t1 VALUES(5);}
59 db eval {SELECT * FROM t1} {
60 if {[catch {db eval ROLLBACK} errmsg]} {
61 set ::ecode [sqlite3_extended_errcode db]
67 } {1 {abort due to ROLLBACK}}
72 db eval {SELECT * FROM t1}
74 unset -nocomplain ecode