]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add SQLITE_FCNTL_BUSYHANDLER. Invoked to provide access to the busy-handler callback...
authordan <dan@noemail.net>
Mon, 1 Oct 2012 18:44:33 +0000 (18:44 +0000)
committerdan <dan@noemail.net>
Mon, 1 Oct 2012 18:44:33 +0000 (18:44 +0000)
FossilOrigin-Name: 1262d2f471214a3417dd02159a7aa2355b18f789

manifest
manifest.uuid
src/pager.c
src/pragma.c
src/sqlite.h.in

index 069ed605a7e81eb5ffcfede47e1900c0ca7d9993..2c021a017cab3258b9bc06b5aeff4e59c240fb31 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Minor\schanges\sto\sthe\squery\splanner\sfor\simproved\stest\scoverage.
-D 2012-10-01T17:44:05.444
+C Add\sSQLITE_FCNTL_BUSYHANDLER.\sInvoked\sto\sprovide\saccess\sto\sthe\sbusy-handler\scallback\sto\scustom\sVFS\simplementations.
+D 2012-10-01T18:44:33.687
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 5f4f26109f9d80829122e0e09f9cda008fa065fb
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -162,13 +162,13 @@ F src/os.h 027491c77d2404c0a678bb3fb06286f331eb9b57
 F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
 F src/os_unix.c a5a45a2857c43b37bac145b521064a85a544cd7a
 F src/os_win.c 90c7a1fe2698867555ba4266f5bd436c85d0d1dc
-F src/pager.c 9f5f2823594cc2848e151510f726af02896485b5
+F src/pager.c 52bfc72f7f8c6e49668803657e8f239e38c529dd
 F src/pager.h bdbc379557eb2e233dfec10986b3086877e72db7
 F src/parse.y f29df90bd3adc64b33114ab1de9fb7768fcf2099
 F src/pcache.c f8043b433a57aba85384a531e3937a804432a346
 F src/pcache.h 1b5dcc3dc8103d03e625b177023ee67764fa6b7c
 F src/pcache1.c 9fd22671c270b35131ef480bbc00392b8b5f8ab9
-F src/pragma.c 7f5a0fa6dead752d9af3a1e1d16bace81d22ef95
+F src/pragma.c 4f31fe4ae4b885a8be8b1db9d94f9f5b6c8b5624
 F src/prepare.c 931ad0d852a0df48f79adcba6ce79ca5f475625c
 F src/printf.c 4a9f882f1c1787a8b494a2987765acf9d97ac21f
 F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
@@ -176,7 +176,7 @@ F src/resolve.c 9e28280ec98035f31900fdd1db01f86f68ca6c32
 F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
 F src/select.c 75c5e37cc882c468383c9d9e07496b9a16cfae3e
 F src/shell.c 8ee5a3cb502e2d574f97b43972e6c1e275e7bec7
-F src/sqlite.h.in cbe846facaba903654b4136c97e7f57b3ac0bac7
+F src/sqlite.h.in c7be05ad191d2634292fcc77bdb2bcfa4526eb98
 F src/sqlite3.rc fea433eb0a59f4c9393c8e6d76a6e2596b1fe0c0
 F src/sqlite3ext.h 6904f4aadf976f95241311fbffb00823075d9477
 F src/sqliteInt.h c29395d6e68cfbcb2661787ae4820e5e256c916a
@@ -1018,7 +1018,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
 F tool/win/sqlite.vsix 67d8a99aceb56384a81b3f30d6c71743146d2cc9
-P f193dbb6b96b2f49dd0d6345802c9c006cd99e3c
-R cc743e0e8cc0407b063f795edee17263
-U drh
-Z 2fb8150c8641aac32ecd5d693f13df87
+P c12044df322283c9deb0d7dacd8a699ac53f27b6
+R d094915a20a7714c82c93282dde9246b
+U dan
+Z a39135b23d456d91a1a24c9caf254ec8
index f781c3b76503e1a9ba800ccc9431a21f22f317e5..1a1f385f50fe651b0fcee4b2dd8f7b8a667deea5 100644 (file)
@@ -1 +1 @@
-c12044df322283c9deb0d7dacd8a699ac53f27b6
\ No newline at end of file
+1262d2f471214a3417dd02159a7aa2355b18f789
\ No newline at end of file
index 28f6546301b0bbf65576f38427ccdac1157e48b5..21279824ad75cd8efeb6c73fa6a906242ed896b0 100644 (file)
@@ -3476,9 +3476,16 @@ void sqlite3PagerSetBusyhandler(
   Pager *pPager,                       /* Pager object */
   int (*xBusyHandler)(void *),         /* Pointer to busy-handler function */
   void *pBusyHandlerArg                /* Argument to pass to xBusyHandler */
-){  
+){
   pPager->xBusyHandler = xBusyHandler;
   pPager->pBusyHandlerArg = pBusyHandlerArg;
+
+  if( isOpen(pPager->fd) ){
+    void **ap = &pPager->xBusyHandler;
+    assert( ((int(*)(void *))(ap[0]))==xBusyHandler );
+    assert( ap[1]==pBusyHandlerArg );
+    sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_BUSYHANDLER, (void *)ap);
+  }
 }
 
 /*
index f41f2db06f7376bda69018def772ea07fb3cfedd..8eaec51ec3e25fe636d49ba484721506af9f0f7b 100644 (file)
@@ -357,6 +357,7 @@ void sqlite3Pragma(
   aFcntl[1] = zLeft;
   aFcntl[2] = zRight;
   aFcntl[3] = 0;
+  db->busyHandler.nBusy = 0;
   rc = sqlite3_file_control(db, zDb, SQLITE_FCNTL_PRAGMA, (void*)aFcntl);
   if( rc==SQLITE_OK ){
     if( aFcntl[0] ){
index bf97679ab85ad19ecfe3632a105d8c7c8719d5ea..0d619e96c0e97ff6a4912aab43a03966296693e8 100644 (file)
@@ -852,6 +852,17 @@ struct sqlite3_io_methods {
 ** file control occurs at the beginning of pragma statement analysis and so
 ** it is able to override built-in [PRAGMA] statements.
 ** </ul>
+**
+** <li>[[SQLITE_FCNTL_BUSYHANDLER]]
+** ^This file-control may be invoked by SQLite on the database file handle
+** shortly after it is opened in order to provide a custom VFS with access
+** to the connections busy-handler callback. The argument is of type (void **)
+** - an array of two (void *) values. The first (void *) actually points
+** to a function of type (int (*)(void *)). In order to invoke the connections
+** busy-handler, this function should be invoked with the second (void *) in
+** the array as the only argument. If it returns non-zero, then the operation
+** should be retried. If it returns zero, the custom VFS should abandon the
+** current operation.
 */
 #define SQLITE_FCNTL_LOCKSTATE               1
 #define SQLITE_GET_LOCKPROXYFILE             2
@@ -867,6 +878,7 @@ struct sqlite3_io_methods {
 #define SQLITE_FCNTL_VFSNAME                12
 #define SQLITE_FCNTL_POWERSAFE_OVERWRITE    13
 #define SQLITE_FCNTL_PRAGMA                 14
+#define SQLITE_FCNTL_BUSYHANDLER            15
 
 /*
 ** CAPI3REF: Mutex Handle