diff --git a/manifest b/manifest index 4254bdb34b..1f476a5710 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sspelling\sof\sPerl\son\sthe\shomepage.\s(CVS\s3319) -D 2006-07-02T10:21:36 +C Change\ssqlite3_busy_timeout\sso\sthat\sit\schecks\sfor\san\sinvalid\sdatabase\npointer.\s(CVS\s3320) +D 2006-07-06T10:59:58 F Makefile.in 9c2a76055c305868cc5f5b73e29a252ff3632c0a F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -49,7 +49,7 @@ F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564 F src/insert.c 63f01d3f4e0ba7ed171934a24aece2191824faec F src/legacy.c 10e01a902d7f2c872c7922fedf19a2df70935857 F src/loadext.c 040853b36adf535bba6a2e9f5d921422a4394baf -F src/main.c 4a9be207fc6d0161eee2e520622260af8b2f187b +F src/main.c be8cb8af8f7c8234e30341e96a1dd9414b5ce73f F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217 F src/os.c 59f05de8c5777c34876607114a2fbe55ae578235 F src/os.h 3fd6a022bafd620fdfd779a51dccb42f31c97f75 @@ -77,7 +77,7 @@ F src/sqlite3ext.h c611255287e9a11ce4f1fe6251c2a0b9d32a828b F src/sqliteInt.h e07a49b3e349c2c5f1bcb7dd9371fc3faf5ba338 F src/table.c d8817f43a6c6bf139487db161760b9e1e02da3f1 F src/tclsqlite.c 32d9e0147077f2e2c127c5f214fb3fe03ef97d18 -F src/test1.c 42c423aad0d9477b1fc229e4d0aa000f2b3310b4 +F src/test1.c 535294d7f21a4127082c4f7a57f225482df9cc36 F src/test2.c ca74a1d8aeb7d9606e8f6b762c5daf85c1a3f92b F src/test3.c 833dc8346e431182ae6bd0648455c3d4cc65a19f F src/test4.c 8b784cd82de158a2317cb4ac4bc86f91ad315e25 @@ -215,7 +215,7 @@ F test/misc1.test 27a6ad11ba6e4b73aeee650ab68053ad7dfd0433 F test/misc2.test 09388e5a2c5c1017ad3ff1c4bf469375def2a0c2 F test/misc3.test 7bd937e2c62bcc6be71939faf068d506467b1e03 F test/misc4.test b043a05dea037cca5989f3ae09552fa16119bc80 -F test/misc5.test 911da8d04989b839b221dd50f31dffdafb51135f +F test/misc5.test a20303ea455f5e209ea3ba9f7fc8d48dace43d67 F test/misuse.test 30b3a458e5a70c31e74c291937b6c82204c59f33 F test/notnull.test 44d600f916b770def8b095a9962dbe3be5a70d82 F test/null.test 9503e1f63e959544c006d9f01709c5b5eab67d54 @@ -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 60616496b7d97fdda99262e2bab25e625151e857 -R f21ef9c9d2a83cb1b73f18058667c707 +P 255c5a99468c47fed0aaffeeeb28d5af9a99ee11 +R b03964d63723030c462302499ff2ade8 U drh -Z 2dc56494ce52f5d2e2f4151155d77d84 +Z 2ee3981b3f2c34f2126176c3f6db2a7c diff --git a/manifest.uuid b/manifest.uuid index 2213e324fb..79dec50f2e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -255c5a99468c47fed0aaffeeeb28d5af9a99ee11 \ No newline at end of file +225a9597b21bde7666451fc2eb7695dc35c438bb \ No newline at end of file diff --git a/src/main.c b/src/main.c index 46ff194625..dc42a82709 100644 --- a/src/main.c +++ b/src/main.c @@ -14,7 +14,7 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: main.c,v 1.350 2006/06/27 20:06:45 drh Exp $ +** $Id: main.c,v 1.351 2006/07/06 10:59:58 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -366,6 +366,9 @@ void sqlite3_progress_handler( ** specified number of milliseconds before returning 0. */ int sqlite3_busy_timeout(sqlite3 *db, int ms){ + if( sqlite3SafetyCheck(db) ){ + return SQLITE_MISUSE; + } if( ms>0 ){ db->busyTimeout = ms; sqlite3_busy_handler(db, sqliteDefaultBusyCallback, (void*)db); diff --git a/src/test1.c b/src/test1.c index 503ed3feae..ac3fae3050 100644 --- a/src/test1.c +++ b/src/test1.c @@ -13,7 +13,7 @@ ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** -** $Id: test1.c,v 1.216 2006/06/27 20:06:45 drh Exp $ +** $Id: test1.c,v 1.217 2006/07/06 10:59:58 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" @@ -3230,6 +3230,33 @@ static int get_autocommit( return TCL_OK; } +/* +** Usage: sqlite3_busy_timeout DB MS +** +** Set the busy timeout. This is more easily done using the timeout +** method of the TCL interface. But we need a way to test the case +** where it returns SQLITE_MISUSE. +*/ +static int test_busy_timeout( + void * clientData, + Tcl_Interp *interp, + int argc, + char **argv +){ + int rc, ms; + sqlite3 *db; + if( argc!=3 ){ + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " DB", 0); + return TCL_ERROR; + } + if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR; + if( Tcl_GetInt(interp, argv[2], &ms) ) return TCL_ERROR; + rc = sqlite3_busy_timeout(db, ms); + Tcl_AppendResult(interp, sqlite3TestErrorName(rc), 0); + return TCL_OK; +} + /* ** Usage: tcl_variable_type VARIABLENAME ** @@ -3715,6 +3742,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ { "sqlite_delete_collation", (Tcl_CmdProc*)delete_collation }, { "sqlite3_get_autocommit", (Tcl_CmdProc*)get_autocommit }, { "sqlite3_stack_used", (Tcl_CmdProc*)test_stack_used }, + { "sqlite3_busy_timeout", (Tcl_CmdProc*)test_busy_timeout }, }; static struct { char *zName; diff --git a/test/misc5.test b/test/misc5.test index 0d2e37f8a5..f966dacb5a 100644 --- a/test/misc5.test +++ b/test/misc5.test @@ -13,7 +13,7 @@ # This file implements tests for miscellanous features that were # left out of other test files. # -# $Id: misc5.test,v 1.12 2006/02/27 23:19:21 drh Exp $ +# $Id: misc5.test,v 1.13 2006/07/06 10:59:58 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -571,4 +571,13 @@ do_test misc5-7.1 { catchsql $sql } {1 {parser stack overflow}} +# Check the MISUSE return from sqlitee3_busy_timeout +# +do_test misc5-8.1 { + set DB [sqlite3_connection_pointer db] + db close + sqlite3_busy_timeout $DB 1000 +} SQLITE_MISUSE +sqlite3 db test.db + finish_test