]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add the "interrupt" method to the TCL interface. Ticket #1889. (CVS 3332)
authordrh <drh@noemail.net>
Mon, 17 Jul 2006 00:02:44 +0000 (00:02 +0000)
committerdrh <drh@noemail.net>
Mon, 17 Jul 2006 00:02:44 +0000 (00:02 +0000)
FossilOrigin-Name: b0d19e575b14778e76ae5d6546fba0d2e9f25e33

manifest
manifest.uuid
src/tclsqlite.c
test/interrupt.test
test/tclsqlite.test

index 5eae50ed7856e2a24c91d959ebd13065478cda84..142428b3193dae0d22eed2adcfb8b9b911996224 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Reset\sTCL\sresults\swhen\sonecolumn\sor\seval\smethods\shave\sno\sreply.\nTicket\s#1887.\s(CVS\s3331)
-D 2006-07-12T00:18:41
+C Add\sthe\s"interrupt"\smethod\sto\sthe\sTCL\sinterface.\s\sTicket\s#1889.\s(CVS\s3332)
+D 2006-07-17T00:02:45
 F Makefile.in 9c2a76055c305868cc5f5b73e29a252ff3632c0a
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -76,7 +76,7 @@ F src/sqlite.h.in 432848ac7f8d7e6fea727668acccec62bdd86cc4
 F src/sqlite3ext.h c611255287e9a11ce4f1fe6251c2a0b9d32a828b
 F src/sqliteInt.h a413094c83dd3e79f129afb9d453b5680651176b
 F src/table.c d8817f43a6c6bf139487db161760b9e1e02da3f1
-F src/tclsqlite.c 64c4a41dac9dae0d2258b06c4229e995d5fa7cc4
+F src/tclsqlite.c 92a997ee5caca4923a6452ff8ebfaa8d37334f4a
 F src/test1.c 535294d7f21a4127082c4f7a57f225482df9cc36
 F src/test2.c ca74a1d8aeb7d9606e8f6b762c5daf85c1a3f92b
 F src/test3.c 833dc8346e431182ae6bd0648455c3d4cc65a19f
@@ -183,7 +183,7 @@ F test/index3.test f66718cd92ce1216819d47e6a156755e4b2c4ca1
 F test/insert.test 42e26d9192f36859938765e6817fb957cf19532b
 F test/insert2.test 5a20e1ace5fa0800b58d28284212290189b49aed
 F test/insert3.test 0096bd9766f94f4fa06ef712658e590b782cb44f
-F test/interrupt.test cd24dc5bedd02325be4bfa5d6209fae01c465157
+F test/interrupt.test c38b7f7c17914f0cd6a119beed5d03bc3f47f9eb
 F test/intpkey.test af4fd826c4784ec5c93b444de07adea0254d0d30
 F test/ioerr.test 804d56cfa698e7c90590921f984eb49ceb30c2a9
 F test/join.test af0443185378b64878750aa1cf4b83c216f246b4
@@ -251,7 +251,7 @@ F test/subselect.test 2d13fb7f450db3595adcdd24079a0dd1d2d6abc2
 F test/sync.test d05397b8f89f423dd6dba528692019ab036bc1c3
 F test/table.test 1c1539af8db89c68e467df02ec2607ec61c67bac
 F test/tableapi.test a1982276274d292110d549206bc365b2da43e2ee
-F test/tclsqlite.test e1ae0280f9150b4c43f2a6f1a16fc5e8511cd747
+F test/tclsqlite.test e7f7b891ccd971379106a656d4b2f27d246cc8fd
 F test/temptable.test c36f3e5a94507abb64f7ba23deeb4e1a8a8c3821
 F test/tester.tcl 0436eda9b45cd937662b9766262cc2527448413f
 F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
@@ -375,7 +375,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 65b60f05ce49ff127bf5044f96db36caf1fa0106
-R c2fe2d2fef5276c6e646e7b15fa1fb09
+P 9c6090c609afa9906029ed4ba22375f5bee058c4
+R ec56b496437631175dc2c4cfe87c3e4f
 U drh
-Z 97a143b73f2650c099952ed39c8d5956
+Z 78911d3d9efaa6da8fd47f85853e0527
index b9a4847b3fee205dc55ab4dcc4e72031baff075a..955b115105db606bbb26b4568eccdc90f60da7d2 100644 (file)
@@ -1 +1 @@
-9c6090c609afa9906029ed4ba22375f5bee058c4
\ No newline at end of file
+b0d19e575b14778e76ae5d6546fba0d2e9f25e33
\ No newline at end of file
index d660c4c53d251442c4f182c1e3115bb71bfdbcca..9e2f3c899252b8a45d5f836addea1ab06e5380fc 100644 (file)
@@ -11,7 +11,7 @@
 *************************************************************************
 ** A TCL Interface to SQLite
 **
-** $Id: tclsqlite.c,v 1.164 2006/07/12 00:18:41 drh Exp $
+** $Id: tclsqlite.c,v 1.165 2006/07/17 00:02:45 drh Exp $
 */
 #ifndef NO_TCL     /* Omit this whole file if TCL is unavailable */
 
@@ -669,11 +669,11 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
     "collation_needed",   "commit_hook",       "complete",
     "copy",               "enable_load_extension","errorcode",
     "eval",               "exists",            "function",
-    "last_insert_rowid",  "nullvalue",         "onecolumn",
-    "profile",            "progress",          "rekey",
-    "rollback_hook",      "timeout",           "total_changes",
-    "trace",              "transaction",       "update_hook",
-    "version",            0                    
+    "interrupt",          "last_insert_rowid", "nullvalue",
+    "onecolumn",          "profile",           "progress",
+    "rekey",              "rollback_hook",     "timeout",
+    "total_changes",      "trace",             "transaction",
+    "update_hook",        "version",           0
   };
   enum DB_enum {
     DB_AUTHORIZER,        DB_BUSY,             DB_CACHE,
@@ -681,11 +681,11 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
     DB_COLLATION_NEEDED,  DB_COMMIT_HOOK,      DB_COMPLETE,
     DB_COPY,              DB_ENABLE_LOAD_EXTENSION,DB_ERRORCODE,
     DB_EVAL,              DB_EXISTS,           DB_FUNCTION,
-    DB_LAST_INSERT_ROWID, DB_NULLVALUE,        DB_ONECOLUMN,
-    DB_PROFILE,           DB_PROGRESS,         DB_REKEY,
-    DB_ROLLBACK_HOOK,     DB_TIMEOUT,          DB_TOTAL_CHANGES,
-    DB_TRACE,             DB_TRANSACTION,      DB_UPDATE_HOOK,
-    DB_VERSION,          
+    DB_INTERRUPT,         DB_LAST_INSERT_ROWID,DB_NULLVALUE,
+    DB_ONECOLUMN,         DB_PROFILE,          DB_PROGRESS,
+    DB_REKEY,             DB_ROLLBACK_HOOK,    DB_TIMEOUT,
+    DB_TOTAL_CHANGES,     DB_TRACE,            DB_TRANSACTION,
+    DB_UPDATE_HOOK,       DB_VERSION,          
   };
   /* don't leave trailing commas on DB_enum, it confuses the AIX xlc compiler */
 
@@ -1610,6 +1610,17 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
     break;
   }
 
+  /*
+  **     $db interrupt
+  **
+  ** Interrupt the execution of the inner-most SQL interpreter.  This
+  ** causes the SQL statement to return an error of SQLITE_INTERRUPT.
+  */
+  case DB_INTERRUPT: {
+    sqlite3_interrupt(pDb->db);
+    break;
+  }
+
   /*
   **     $db nullvalue ?STRING?
   **
index f5ecbf1fee2658cebd1c1b7c41590ecdbb2df818..7e1ec0a27e4dd4b7f92193f8b1f930920617f308 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this script is the sqlite_interrupt() API.
 #
-# $Id: interrupt.test,v 1.12 2006/01/03 00:33:50 drh Exp $
+# $Id: interrupt.test,v 1.13 2006/07/17 00:02:46 drh Exp $
 
 
 set testdir [file dirname $argv0]
@@ -34,7 +34,7 @@ proc cksum {{db db}} {
 }
 
 # This routine attempts to execute the sql in $sql.  It triggers an
-# interrupt a progressively later and later points during the processing
+# interrupt at progressively later and later points during the processing
 # and checks to make sure SQLITE_INTERRUPT is returned.  Eventually,
 # the routine completes successfully.
 #
@@ -186,5 +186,12 @@ do_test interrupt-5.1 {
     CREATE INDEX fake ON fake1(a COLLATE fake_collation, b, c DESC);
   }
 } {1 interrupt}
+do_test interrupt-5.2 {
+  proc fake_interrupt {args} {db interrupt; return SQLITE_OK}
+  db collation_needed fake_interrupt
+  catchsql {
+    CREATE INDEX fake ON fake1(a COLLATE fake_collation, b, c DESC);
+  }
+} {1 interrupt}
 
 finish_test
index ca9582a54fb6ebf79ac3e6d529f2b09858b04ec9..0c3de04aa9ef8d7a1b538410e516171373847be7 100644 (file)
@@ -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.54 2006/07/06 17:08:48 drh Exp $
+# $Id: tclsqlite.test,v 1.55 2006/07/17 00:02:46 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -34,7 +34,7 @@ do_test tcl-1.1 {
 do_test tcl-1.2 {
   set v [catch {db bogus} msg]
   lappend v $msg
-} {1 {bad option "bogus": must be authorizer, busy, cache, changes, close, collate, collation_needed, commit_hook, complete, copy, enable_load_extension, errorcode, eval, exists, function, last_insert_rowid, nullvalue, onecolumn, profile, progress, rekey, rollback_hook, timeout, total_changes, trace, transaction, update_hook, or version}}
+} {1 {bad option "bogus": must be authorizer, busy, cache, changes, close, collate, collation_needed, commit_hook, complete, copy, enable_load_extension, errorcode, eval, exists, function, interrupt, last_insert_rowid, nullvalue, onecolumn, profile, progress, rekey, rollback_hook, timeout, total_changes, trace, transaction, update_hook, or version}}
 do_test tcl-1.3 {
   execsql {CREATE TABLE t1(a int, b int)}
   execsql {INSERT INTO t1 VALUES(10,20)}