]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add a documentation comment for sqlite3rbu_vacuum() to sqlite3rbu.h.
authordan <dan@noemail.net>
Wed, 20 Apr 2016 20:08:58 +0000 (20:08 +0000)
committerdan <dan@noemail.net>
Wed, 20 Apr 2016 20:08:58 +0000 (20:08 +0000)
FossilOrigin-Name: da5c753ddac3cbfdf03710a82f5fd9fa2e29e819

ext/rbu/sqlite3rbu.c
ext/rbu/sqlite3rbu.h
manifest
manifest.uuid

index 8a1b06dd62a1b21858a177b5243c18a7587e47b7..022e682bde8488cc51c83ba7e2de9e3898710339 100644 (file)
@@ -2352,9 +2352,45 @@ static void rbuOpenDatabase(sqlite3rbu *p){
     memcpy(p->zStateDb, "main", 4);
   }
 
+#if 0
+  if( p->rc==SQLITE_OK && rbuIsVacuum(p) ){
+    p->rc = sqlite3_exec(p->dbRbu, "BEGIN", 0, 0, 0);
+  }
+#endif
+
   /* If it has not already been created, create the rbu_state table */
   rbuMPrintfExec(p, p->dbRbu, RBU_CREATE_STATE, p->zStateDb);
 
+#if 0
+  if( rbuIsVacuum(p) ){
+    if( p->rc==SQLITE_OK ){
+      int rc2;
+      int bOk = 0;
+      sqlite3_stmt *pCnt = 0;
+      p->rc = prepareAndCollectError(p->dbRbu, &pCnt, &p->zErrmsg,
+          "SELECT count(*) FROM stat.sqlite_master"
+      );
+      if( p->rc==SQLITE_OK 
+       && sqlite3_step(pCnt)==SQLITE_ROW
+       && 1==sqlite3_column_int(pCnt, 0)
+      ){
+        bOk = 1;
+      }
+      rc2 = sqlite3_finalize(pCnt);
+      if( p->rc==SQLITE_OK ) p->rc = rc2;
+
+      if( p->rc==SQLITE_OK && bOk==0 ){
+        p->rc = SQLITE_ERROR;
+        p->zErrmsg = sqlite3_mprintf("invalid state database");
+      }
+    
+      if( p->rc==SQLITE_OK ){
+        p->rc = sqlite3_exec(p->dbRbu, "COMMIT", 0, 0, 0);
+      }
+    }
+  }
+#endif
+
   if( p->rc==SQLITE_OK && rbuIsVacuum(p) ){
     int bOpen = 0;
     int rc;
index b910866293b21f76e166fe666506a11e2ce73b5a..c0c95e51fdfabd8c1f5cd13f951aa7ef8249d483 100644 (file)
@@ -315,7 +315,27 @@ sqlite3rbu *sqlite3rbu_open(
 );
 
 /*
-** Open an RBU handle to perform an RBU vacuum database file zTarget.
+** Open an RBU handle to perform an RBU vacuum on database file zTarget.
+** An RBU vacuum is similar to SQLite's built-in VACUUM command, except
+** that it can be suspended and resumed like an RBU update.
+**
+** The second argument to this function, which may not be NULL, identifies 
+** a database in which to store the state of the RBU vacuum operation if
+** it is suspended. The first time sqlite3rbu_vacuum() is called, to start
+** an RBU vacuum operation, the state database should either not exist or
+** be empty (contain no tables). If an RBU vacuum is suspended by calling
+** sqlite3rbu_close() on the RBU handle before sqlite3rbu_step() has
+** returned SQLITE_DONE, the vacuum state is stored in the state database. 
+** The vacuum can be resumed by calling this function to open a new RBU
+** handle specifying the same target and state databases.
+**
+** This function does not delete the state database after an RBU vacuum
+** is completed, even if it created it.
+**
+** As with sqlite3rbu_open(), Zipvfs users should rever to the comment
+** describing the sqlite3rbu_create_vfs() API function below for 
+** a description of the complications associated with using RBU with 
+** zipvfs databases.
 */
 sqlite3rbu *sqlite3rbu_vacuum(
   const char *zTarget, 
index e640d710d059a5e1ed267d93c9f0ecc06f7a75f6..1ec956e979d9d87c3510d42e9a1eda57e211e6eb 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sfault\sinjection\stests\sfor\srbu\svacuum.\sFix\ssome\sproblems\srevealed\sby\sthe\ssame.
-D 2016-04-20T17:47:52.967
+C Add\sa\sdocumentation\scomment\sfor\ssqlite3rbu_vacuum()\sto\ssqlite3rbu.h.
+D 2016-04-20T20:08:58.990
 F Makefile.in eba680121821b8a60940a81454316f47a341487a
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 71b8b16cf9393f68e2e2035486ca104872558836
@@ -248,8 +248,8 @@ F ext/rbu/rbufts.test 828cd689da825f0a7b7c53ffc1f6f7fdb6fa5bda
 F ext/rbu/rbuprogress.test 2023a7df2c523e3df1cb532eff811cda385a789a
 F ext/rbu/rbusave.test 0f43b6686084f426ddd040b878426452fd2c2f48
 F ext/rbu/rbuvacuum.test ecd7ce1cd8528d6230b56f4840bbb7188cee6946
-F ext/rbu/sqlite3rbu.c cc44505ef06053077f35b08c4ba11dc8bcf310dc
-F ext/rbu/sqlite3rbu.h 1342ab6121e715b8da59ec35c5b5c16060be7a6b
+F ext/rbu/sqlite3rbu.c 80ab68658a1dc1921a3eee7c666c948ea640087c
+F ext/rbu/sqlite3rbu.h efcafd0e36861943a88deb181753236f84dbc244
 F ext/rbu/test_rbu.c 430b8b9520c233505371d564d3561e0b554355f4
 F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
 F ext/rtree/rtree.c 0b870ccb7b58b734a2a8e1e2755a7c0ded070920
@@ -1484,7 +1484,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 74ffea76b8c9ddd7699ce6ca77dce005bd7922ac
-R f86f4403b5c8adf842292353673eca81
+P f042fdd1ea7febec7228e51efc2b0281805e196a
+R 20401012c91c212b91bec1accca1e5a8
 U dan
-Z 6e60b344cf662b4bf49e9c442360b79f
+Z ebff3ad2f969914e02c51eda888da39a
index ce2dab7023d462c4c66781a6b4c18596617e8f97..ffe63d9829c67870138a560e0fc5db4ea310ca5b 100644 (file)
@@ -1 +1 @@
-f042fdd1ea7febec7228e51efc2b0281805e196a
\ No newline at end of file
+da5c753ddac3cbfdf03710a82f5fd9fa2e29e819
\ No newline at end of file