1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Have PRAGMA busy_timeout return 0 if the busy handler has been changed

or cancelled.

FossilOrigin-Name: 7be5bc36798d30f50658b70fc0bd31af897f3a87
This commit is contained in:
drh
2012-09-07 18:49:57 +00:00
parent f360396c47
commit c0c7b5ee74
4 changed files with 13 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
C Add\san\sexperimental\sbusy_timeout\spragma\sto\sfacilitate\saccess\sto\sthe\nsqlite3_busy_timeout()\sinterfaces\sfor\sprogrammers\sthat\sare\sworking\sfrom\nbehind\sa\slanguage\swrapper\sthat\sdoes\snot\sexpose\sthat\sinterface. C Have\sPRAGMA\sbusy_timeout\sreturn\s0\sif\sthe\sbusy\shandler\shas\sbeen\schanged\nor\scancelled.
D 2012-09-07T16:46:59.378 D 2012-09-07T18:49:57.818
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in abd5c10d21d1395f140d9e50ea999df8fa4d6376 F Makefile.in abd5c10d21d1395f140d9e50ea999df8fa4d6376
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -145,7 +145,7 @@ F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e
F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
F src/lempar.c 0ee69fca0be54cd93939df98d2aca4ca46f44416 F src/lempar.c 0ee69fca0be54cd93939df98d2aca4ca46f44416
F src/loadext.c f20382fbaeec832438a1ba7797bee3d3c8a6d51d F src/loadext.c f20382fbaeec832438a1ba7797bee3d3c8a6d51d
F src/main.c 31af732aa4363e85816b09794429c79fe4baa3ac F src/main.c 0b321fc873ff2c09b996dea9f74443e4cd9ae28d
F src/malloc.c fe085aa851b666b7c375c1ff957643dc20a04bf6 F src/malloc.c fe085aa851b666b7c375c1ff957643dc20a04bf6
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c 437c7c4af964895d4650f29881df63535caaa1fa F src/mem1.c 437c7c4af964895d4650f29881df63535caaa1fa
@@ -170,7 +170,7 @@ F src/parse.y f29df90bd3adc64b33114ab1de9fb7768fcf2099
F src/pcache.c f8043b433a57aba85384a531e3937a804432a346 F src/pcache.c f8043b433a57aba85384a531e3937a804432a346
F src/pcache.h 1b5dcc3dc8103d03e625b177023ee67764fa6b7c F src/pcache.h 1b5dcc3dc8103d03e625b177023ee67764fa6b7c
F src/pcache1.c 9fd22671c270b35131ef480bbc00392b8b5f8ab9 F src/pcache1.c 9fd22671c270b35131ef480bbc00392b8b5f8ab9
F src/pragma.c e09950b9d0a35c1bf2329038c10f38589e754ae8 F src/pragma.c 360ac85ad9bfbab2302e8b7ba524af842f497cef
F src/prepare.c 33291b83cca285718048d219c67b8298501fa3a5 F src/prepare.c 33291b83cca285718048d219c67b8298501fa3a5
F src/printf.c 4a9f882f1c1787a8b494a2987765acf9d97ac21f F src/printf.c 4a9f882f1c1787a8b494a2987765acf9d97ac21f
F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50 F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
@@ -1014,10 +1014,7 @@ F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 67d8a99aceb56384a81b3f30d6c71743146d2cc9 F tool/win/sqlite.vsix 67d8a99aceb56384a81b3f30d6c71743146d2cc9
P 39f763bfc04174ee0fe2cdf6a92b7c12f726bd1b P 22ebc668516bc3dd5782d6d3d42dc7fd2eed7d79
R 7a209eaa28bbe6aeaf699b5d2296eb6d R 123b3377f1885f394458b43e10ba3388
T *branch * busy-timeout-pragma
T *sym-busy-timeout-pragma *
T -sym-trunk *
U drh U drh
Z 3457f6820fedfafcfc1fb25157630cb3 Z ffcbc3d2ba50a5d9635e1edbbde2b179

View File

@@ -1 +1 @@
22ebc668516bc3dd5782d6d3d42dc7fd2eed7d79 7be5bc36798d30f50658b70fc0bd31af897f3a87

View File

@@ -1116,6 +1116,7 @@ int sqlite3_busy_handler(
db->busyHandler.xFunc = xBusy; db->busyHandler.xFunc = xBusy;
db->busyHandler.pArg = pArg; db->busyHandler.pArg = pArg;
db->busyHandler.nBusy = 0; db->busyHandler.nBusy = 0;
db->busyTimeout = 0;
sqlite3_mutex_leave(db->mutex); sqlite3_mutex_leave(db->mutex);
return SQLITE_OK; return SQLITE_OK;
} }
@@ -1153,10 +1154,9 @@ void sqlite3_progress_handler(
*/ */
int sqlite3_busy_timeout(sqlite3 *db, int ms){ int sqlite3_busy_timeout(sqlite3 *db, int ms){
if( ms>0 ){ if( ms>0 ){
db->busyTimeout = ms;
sqlite3_busy_handler(db, sqliteDefaultBusyCallback, (void*)db); sqlite3_busy_handler(db, sqliteDefaultBusyCallback, (void*)db);
db->busyTimeout = ms;
}else{ }else{
db->busyTimeout = 0;
sqlite3_busy_handler(db, 0, 0); sqlite3_busy_handler(db, 0, 0);
} }
return SQLITE_OK; return SQLITE_OK;

View File

@@ -1541,9 +1541,9 @@ void sqlite3Pragma(
** PRAGMA busy_timeout = N ** PRAGMA busy_timeout = N
** **
** Call sqlite3_busy_timeout(db, N). Return the current timeout value ** Call sqlite3_busy_timeout(db, N). Return the current timeout value
** if one is set. If the busy handler is not set to the default ** if one is set. If no busy handler or a different busy handler is set
** busy callback, then the return value is undefined. A value of N ** then 0 is returned. Setting the busy_timeout to 0 or negative
** which is 0 or negative disables the busy handler. ** disables the timeout.
*/ */
if( sqlite3StrICmp(zLeft, "busy_timeout")==0 ){ if( sqlite3StrICmp(zLeft, "busy_timeout")==0 ){
if( zRight ){ if( zRight ){