]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add extra debugging function to test_rbu.c. Enhance the documentation for sqlite3rbu_...
authordan <dan@noemail.net>
Wed, 21 Oct 2015 08:26:01 +0000 (08:26 +0000)
committerdan <dan@noemail.net>
Wed, 21 Oct 2015 08:26:01 +0000 (08:26 +0000)
FossilOrigin-Name: b9c4aa521156d8ca09151a82a7e80aa8d1d7a313

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

index 65d1c5f6e50cf9a1f95d2d57e58acd3837b42826..f1a0f3cd845ed3858882b069299c956b9167fa7b 100644 (file)
@@ -341,6 +341,9 @@ sqlite3rbu *sqlite3rbu_open(
 ** If an error has occurred, either while opening or stepping the RBU object,
 ** this function may return NULL. The error code and message may be collected
 ** when sqlite3rbu_close() is called.
+**
+** Database handles returned by this function remain valid until the next
+** call to any sqlite3rbu_xxx() function other than sqlite3rbu_db().
 */
 sqlite3 *sqlite3rbu_db(sqlite3rbu*, int bRbu);
 
index 6648f28e8b753b7073f77cd381e79d516c49988c..3fa85b756909b72f2c01874c4422f2e5f9b0a594 100644 (file)
@@ -56,20 +56,34 @@ static int test_sqlite3rbu_cmd(
 ){
   int ret = TCL_OK;
   sqlite3rbu *pRbu = (sqlite3rbu*)clientData;
-  const char *azMethod[] = { 
-    "step", "close", "create_rbu_delta", "savestate", 0 
+  struct RbuCmd {
+    const char *zName;
+    int nArg;
+    const char *zUsage;
+  } aCmd[] = {
+    {"step", 2, ""},              /* 0 */
+    {"close", 2, ""},             /* 1 */
+    {"create_rbu_delta", 2, ""},  /* 2 */
+    {"savestate", 2, ""},         /* 3 */
+    {"dbMain_eval", 3, "SQL"},    /* 4 */
+    {0,0,0}
   };
-  int iMethod;
+  int iCmd;
 
-  if( objc!=2 ){
+  if( objc<2 ){
     Tcl_WrongNumArgs(interp, 1, objv, "METHOD");
     return TCL_ERROR;
   }
-  if( Tcl_GetIndexFromObj(interp, objv[1], azMethod, "method", 0, &iMethod) ){
+  ret = Tcl_GetIndexFromObjStruct(
+      interp, objv[1], aCmd, sizeof(aCmd[0]), "method", 0, &iCmd
+  );
+  if( ret ) return TCL_ERROR;
+  if( objc!=aCmd[iCmd].nArg ){
+    Tcl_WrongNumArgs(interp, 1, objv, aCmd[iCmd].zUsage);
     return TCL_ERROR;
   }
 
-  switch( iMethod ){
+  switch( iCmd ){
     case 0: /* step */ {
       int rc = sqlite3rbu_step(pRbu);
       Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
@@ -112,6 +126,16 @@ static int test_sqlite3rbu_cmd(
       break;
     }
 
+    case 4: /* dbMain_eval */ {
+      sqlite3 *db = sqlite3rbu_db(pRbu, 0);
+      int rc = sqlite3_exec(db, Tcl_GetString(objv[2]), 0, 0, 0);
+      if( rc!=SQLITE_OK ){
+        Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3_errmsg(db), -1));
+        ret = TCL_ERROR;
+      }
+      break;
+    }
+
     default: /* seems unlikely */
       assert( !"cannot happen" );
       break;
index e406cb4dc031bac103749d53048015ae950314c6..05c2a89ea410335b4025d7666d7bbad843d89217 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sharmless\scompiler\swarnings\sin\sFTS5.
-D 2015-10-20T23:27:14.365
+C Add\sextra\sdebugging\sfunction\sto\stest_rbu.c.\sEnhance\sthe\sdocumentation\sfor\ssqlite3rbu_db()\sto\sdefine\sthe\svalidity\sof\sthe\sreturned\sdatabase\shandles.
+D 2015-10-21T08:26:01.477
 F Makefile.in 2ea961bc09e441874eb3d1bf7398e04feb24f3ee
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 4eb750e0fdf52050a06d881e1b060f4bb116ed7e
@@ -230,8 +230,8 @@ F ext/rbu/rbufault2.test 9a7f19edd6ea35c4c9f807d8a3db0a03a5670c06
 F ext/rbu/rbufts.test 828cd689da825f0a7b7c53ffc1f6f7fdb6fa5bda
 F ext/rbu/rbusave.test 0f43b6686084f426ddd040b878426452fd2c2f48
 F ext/rbu/sqlite3rbu.c ea47de615e911b3a69a8e7fb3be3866298403a25
-F ext/rbu/sqlite3rbu.h 1d568cb33738d7900975cc5c72e6f68049f15914
-F ext/rbu/test_rbu.c 2a3652241fa45d5eaa141775e4ae68c1d3582c03
+F ext/rbu/sqlite3rbu.h 0bdeb3be211aaba7d85445fa36f4701a25a3dbde
+F ext/rbu/test_rbu.c 4a4cdcef4ef9379fc2a21f008805c80b27bcf573
 F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
 F ext/rtree/rtree.c 0f9b595bd0debcbedf1d7a63d0e0678d619e6c9c
 F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
@@ -1391,7 +1391,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P b8fb263ed1b36d085437131795505e53af103d26
-R 95702bd1633e56deaa7f0c8cd9294ab7
-U mistachkin
-Z 2868708b35b26115fe25354e42651fac
+P 0a903ec26bfbbe9bfd18bc34934e689ffdb01ce5
+R c0f5065bff60d0df79ae9d2bf6514716
+U dan
+Z 2c0acb856eea548f945a4e7fa327a156
index ea64a17af2178f1e822503080f5f34b78f230113..c6965600bc9446c51f79caed7721645776b7a6f5 100644 (file)
@@ -1 +1 @@
-0a903ec26bfbbe9bfd18bc34934e689ffdb01ce5
\ No newline at end of file
+b9c4aa521156d8ca09151a82a7e80aa8d1d7a313
\ No newline at end of file