From: drh Date: Tue, 2 Aug 2005 17:15:14 +0000 (+0000) Subject: Tests and bug fixes on the new transaction method in the TCL interface. (CVS 2574) X-Git-Tag: version-3.6.10~3585 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b5555e7e34e10c701962c4f318f3791a385fabe1;p=thirdparty%2Fsqlite.git Tests and bug fixes on the new transaction method in the TCL interface. (CVS 2574) FossilOrigin-Name: 68dd0ed5e312ecd5e98ee0fa1c21b70ff330f711 --- diff --git a/manifest b/manifest index bdad59f11e..93085bfe50 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sbug\sin\sthe\sbtree\sbalancer.\sticket\s#1346.\s(CVS\s2573) -D 2005-08-02T17:13:10 +C Tests\sand\sbug\sfixes\son\sthe\snew\stransaction\smethod\sin\sthe\sTCL\sinterface.\s(CVS\s2574) +D 2005-08-02T17:15:15 F Makefile.in 22ea9c0fe748f591712d8fe3c6d972c6c173a165 F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -66,7 +66,7 @@ F src/shell.c 25b3217d7c64e6497225439d261a253a23efff26 F src/sqlite.h.in 7ccf2f61de2a0dca515e73708e561362e6c3d1e3 F src/sqliteInt.h 4cacefaca973cbf8e6a82910c704bf9b4a32fdf1 F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9 -F src/tclsqlite.c b24407b7363d6535e9ccf5e5bc8c68e3c879c340 +F src/tclsqlite.c 96feead1f1d301efa1d3ac6b89ecea7592ab18f9 F src/test1.c 4268e81180a7f9b396a4cf2aa7f268d828cfdf74 F src/test2.c 716c1809dba8e5be6093703e9cada99d627542dc F src/test3.c 683e1e3819152ffd35da2f201e507228921148d0 @@ -202,7 +202,7 @@ F test/subquery.test 0df3de0dbb65165b96ebe895550f1549d5439856 F test/subselect.test 3f3f7a940dc3195c3139f4d530385cb54665d614 F test/table.test e87fb2211b97c6a3a367fbc116e8572091b53160 F test/tableapi.test 6a66d58b37d46dc0f2b3c7d4bd2617d209399bd1 -F test/tclsqlite.test 2679b0fa8397717c0a57609011a0727cb0c6510c +F test/tclsqlite.test a8d9afe680c466881a40252a86ef0fca457ab08c F test/temptable.test c71eeffe8af807f76eafdc5a39824639a1e301df F test/tester.tcl 98ecdc5723b3b2be5a8a5c3a7f38fa53031466ee F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35 @@ -290,7 +290,7 @@ F www/tclsqlite.tcl 425be741b8ae664f55cb1ef2371aab0a75109cf9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b F www/whentouse.tcl 528299b8316726dbcc5548e9aa0648c8b1bd055b -P a5ce6c58c3bfc0e1c9953fe4ad4991ac56a4fb87 -R 4a8c7582f7970695b98ddf619a01cae9 +P 3af69a49289f52f321ccd365e92d22b820c3139e +R e54f832fc40dee5878f5ae1e6fa3f4c7 U drh -Z 991528171fafbc48e93c00ec9f920c3c +Z 2343b82c522f82173d0ffa2bed3924c1 diff --git a/manifest.uuid b/manifest.uuid index 92b4df6c4a..4a7951c3a1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3af69a49289f52f321ccd365e92d22b820c3139e \ No newline at end of file +68dd0ed5e312ecd5e98ee0fa1c21b70ff330f711 \ No newline at end of file diff --git a/src/tclsqlite.c b/src/tclsqlite.c index f07d560096..91398181a1 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -11,7 +11,7 @@ ************************************************************************* ** A TCL Interface to SQLite ** -** $Id: tclsqlite.c,v 1.129 2005/08/02 12:21:09 drh Exp $ +** $Id: tclsqlite.c,v 1.130 2005/08/02 17:15:15 drh Exp $ */ #ifndef NO_TCL /* Omit this whole file if TCL is unavailable */ @@ -1518,7 +1518,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ TTYPE_DEFERRED, TTYPE_EXCLUSIVE, TTYPE_IMMEDIATE }; int ttype; - if( Tcl_GetIndexFromObj(interp, objv[2], TTYPE_strs, "transaction_type", + if( Tcl_GetIndexFromObj(interp, objv[2], TTYPE_strs, "transaction type", 0, &ttype) ){ return TCL_ERROR; } diff --git a/test/tclsqlite.test b/test/tclsqlite.test index 9f56e4639d..fd52b245df 100644 --- a/test/tclsqlite.test +++ b/test/tclsqlite.test @@ -15,7 +15,7 @@ # interface is pretty well tested. This file contains some addition # tests for fringe issues that the main test suite does not cover. # -# $Id: tclsqlite.test,v 1.42 2005/08/02 12:21:10 drh Exp $ +# $Id: tclsqlite.test,v 1.43 2005/08/02 17:15:16 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -348,5 +348,91 @@ do_test tcl-9.11 { execsql {SELECT r1(100)} } {5050} +# Tests for the new transaction method +# +do_test tcl-10.1 { + db transaction {} +} {} +do_test tcl-10.2 { + db transaction deferred {} +} {} +do_test tcl-10.3 { + db transaction immediate {} +} {} +do_test tcl-10.4 { + db transaction exclusive {} +} {} +do_test tcl-10.5 { + set rc [catch {db transaction xyzzy {}} msg] + lappend rc $msg +} {1 {bad transaction type "xyzzy": must be deferred, exclusive, or immediate}} +do_test tcl-10.6 { + set rc [catch {db transaction {error test-error}} msg] + lappend rc $msg +} {1 test-error} +do_test tcl-10.7 { + db transaction { + db eval {CREATE TABLE t4(x)} + db transaction { + db eval {INSERT INTO t4 VALUES(1)} + } + } + db eval {SELECT * FROM t4} +} 1 +do_test tcl-10.8 { + catch { + db transaction { + db eval {INSERT INTO t4 VALUES(2)} + db eval {INSERT INTO t4 VALUES(3)} + db eval {INSERT INTO t4 VALUES(4)} + error test-error + } + } + db eval {SELECT * FROM t4} +} 1 +do_test tcl-10.9 { + db transaction { + db eval {INSERT INTO t4 VALUES(2)} + catch { + db transaction { + db eval {INSERT INTO t4 VALUES(3)} + db eval {INSERT INTO t4 VALUES(4)} + error test-error + } + } + } + db eval {SELECT * FROM t4} +} {1 2 3 4} +do_test tcl-10.10 { + for {set i 0} {$i<1} {incr i} { + db transaction { + db eval {INSERT INTO t4 VALUES(5)} + continue + } + } + db eval {SELECT * FROM t4} +} {1 2 3 4 5} +do_test tcl-10.11 { + for {set i 0} {$i<10} {incr i} { + db transaction { + db eval {INSERT INTO t4 VALUES(6)} + break + } + } + db eval {SELECT * FROM t4} +} {1 2 3 4 5 6} +do_test tcl-10.12 { + set rc [catch { + for {set i 0} {$i<10} {incr i} { + db transaction { + db eval {INSERT INTO t4 VALUES(7)} + return + } + } + }] +} {2} +do_test tcl-10.13 { + db eval {SELECT * FROM t4} +} {1 2 3 4 5 6 7} finish_test