From 3e0a3c9df49653bf28d83d684fe0277a361b30fc Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 3 Nov 2008 21:40:00 +0000 Subject: [PATCH] Test cases to verify that COMMIT and ROLLBACK return SQLITE_BUSY when there are active statements. (CVS 5858) FossilOrigin-Name: cedfa214e4e979ab04a30f558f767d46862151de --- manifest | 11 +++---- manifest.uuid | 2 +- test/trans3.test | 75 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 6 deletions(-) create mode 100644 test/trans3.test diff --git a/manifest b/manifest index c17c7ff5a1..8cd2dc9a50 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\sthe\sname\sof\sthe\sCursor\sobject\sto\sVdbeCursor.\s(CVS\s5857) -D 2008-11-03T20:55:07 +C Test\scases\sto\sverify\sthat\sCOMMIT\sand\sROLLBACK\sreturn\sSQLITE_BUSY\swhen\nthere\sare\sactive\sstatements.\s(CVS\s5858) +D 2008-11-03T21:40:00 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in da817da72422f9b876602c225fcd17d6ca4182f7 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -579,6 +579,7 @@ F test/tokenize.test ce430a7aed48fc98301611429595883fdfcab5d7 F test/trace.test 951cd0f5f571e7f36bf7bfe04be70f90fb16fb00 F test/trans.test 2fd24cd7aa0b879d49a224cbd647d698f1e7ac5c F test/trans2.test d5337e61de45e66b1fcbf9db833fa8c82e624b22 +F test/trans3.test b084fce94d4c9957b01715cc9b6923c573562cdd F test/trigger1.test 53342dfd582155a599518f1918fdc997e9413177 F test/trigger2.test 33bf8ae9b788013be194efe5f66c04a202facbb4 F test/trigger3.test 501b8489eb6b9cb5b005f60b071583c01a3c3041 @@ -653,7 +654,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P aca6b260c0dd1a1515b70f3567a0653b6bcdeea2 -R b9c53d3f4a7f5c2c3f4af9c477dc38c4 +P fdb98fd8c1706085ebeef8e48ac6737839bed5e5 +R 9c7bda7190e22054b1774abf6505159c U drh -Z 8343f2dbffff187aba2a74daa96aa1fc +Z 49be2f942838987ce25cf1c29fa9eda5 diff --git a/manifest.uuid b/manifest.uuid index 80aaeea55d..6215aadbe3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fdb98fd8c1706085ebeef8e48ac6737839bed5e5 \ No newline at end of file +cedfa214e4e979ab04a30f558f767d46862151de \ No newline at end of file diff --git a/test/trans3.test b/test/trans3.test new file mode 100644 index 0000000000..d44cd661d8 --- /dev/null +++ b/test/trans3.test @@ -0,0 +1,75 @@ +# 2008 November 3 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# +# This file implements regression tests for SQLite library. The +# focus of this script is the response of COMMIT and ROLLBACK when +# statements are still pending. +# +# $Id: trans3.test,v 1.1 2008/11/03 21:40:00 drh Exp $ +# +set testdir [file dirname $argv0] +source $testdir/tester.tcl +unset -nocomplain ecode + +do_test trans3-1.1 { + db eval { + CREATE TABLE t1(x); + INSERT INTO t1 VALUES(1); + INSERT INTO t1 VALUES(2); + INSERT INTO t1 VALUES(3); + SELECT * FROM t1; + } +} {1 2 3} +do_test trans3-1.2 { + db eval BEGIN + db eval {INSERT INTO t1 VALUES(4);} + set ::ecode {} + set x [catch { + db eval {SELECT * FROM t1} { + if {[catch {db eval COMMIT} errmsg]} { + set ::ecode [sqlite3_extended_errcode db] + error $errmsg + } + } + } errmsg] + lappend x $errmsg +} {1 {cannot commit transaction - SQL statements in progress}} +do_test trans3-1.3 { + set ::ecode +} {SQLITE_BUSY} +do_test trans3-1.4 { + db eval COMMIT + db eval {SELECT * FROM t1} +} {1 2 3 4} +do_test trans3-1.5 { + db eval BEGIN + db eval {INSERT INTO t1 VALUES(5);} + set ::ecode {} + set x [catch { + db eval {SELECT * FROM t1} { + if {[catch {db eval ROLLBACK} errmsg]} { + set ::ecode [sqlite3_extended_errcode db] + error $errmsg + } + } + } errmsg] + lappend x $errmsg +} {1 {cannot rollback transaction - SQL statements in progress}} +do_test trans3-1.6 { + set ::ecode +} {SQLITE_BUSY} +do_test trans3-1.7 { + db eval COMMIT + db eval {SELECT * FROM t1} +} {1 2 3 4 5} +unset -nocomplain ecode + +finish_test -- 2.47.2