]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Update the sqlite3ota_db() API to account for the fact that each OTA handle now uses...
authordan <dan@noemail.net>
Mon, 23 Feb 2015 15:02:13 +0000 (15:02 +0000)
committerdan <dan@noemail.net>
Mon, 23 Feb 2015 15:02:13 +0000 (15:02 +0000)
FossilOrigin-Name: ef08ecceb7e237a01af6cc3141dccee09ffe9ae3

ext/ota/sqlite3ota.c
ext/ota/sqlite3ota.h
ext/ota/test_ota.c
manifest
manifest.uuid

index d2f8d99ec8537d63fcfdefbce13b53c1a8c9b755..369f035e418af0a9a2d417bf5bf93df750a425aa 100644 (file)
@@ -2648,8 +2648,12 @@ sqlite3ota *sqlite3ota_open(const char *zTarget, const char *zOta){
 /*
 ** Return the database handle used by pOta.
 */
-sqlite3 *sqlite3ota_db(sqlite3ota *pOta){
-  return (pOta ? pOta->dbMain : 0);
+sqlite3 *sqlite3ota_db(sqlite3ota *pOta, int bOta){
+  sqlite3 *db = 0;
+  if( pOta ){
+    db = (bOta ? pOta->dbOta : pOta->dbMain);
+  }
+  return db;
 }
 
 
index 814cd7f0edd23e5af495face69d795b59341fead..ed5f652c2f6c89a6c8550bc93cae978c15152d02 100644 (file)
@@ -250,23 +250,30 @@ typedef struct sqlite3ota sqlite3ota;
 sqlite3ota *sqlite3ota_open(const char *zTarget, const char *zOta);
 
 /*
-** Obtain the underlying database handle used by the OTA extension.
+** Internally, each OTA connection uses a separate SQLite database 
+** connection to access the target and ota update databases. This
+** API allows the application direct access to these database handles.
 **
-** The only argument passed to this function must be a valid, open, OTA
-** handle. This function returns the database handle used by OTA for all
-** operations on the target and source databases. This may be useful in 
-** two scenarios:
+** The first argument passed to this function must be a valid, open, OTA
+** handle. The second argument should be passed zero to access the target
+** database handle, or non-zero to access the ota update database handle.
+** Accessing the underlying database handles may be useful in the
+** following scenarios:
+**
+**   * If any target tables are virtual tables, it may be necessary to
+**     call sqlite3_create_module() on the target database handle to 
+**     register the required virtual table implementations.
 **
 **   * If the data_xxx tables in the OTA source database are virtual 
-**     tables, or if any of the tables being updated are virtual tables,
-**     the application may need to call sqlite3_create_module() on
-**     the db handle to register the required virtual table implementations.
+**     tables, the application may need to call sqlite3_create_module() on
+**     the ota update db handle to any required virtual table
+**     implementations.
 **
 **   * If the application uses the "ota_delta()" feature described above,
 **     it must use sqlite3_create_function() or similar to register the
-**     ota_delta() implementation with OTA.
+**     ota_delta() implementation with the target database handle.
 */
-sqlite3 *sqlite3ota_db(sqlite3ota*);
+sqlite3 *sqlite3ota_db(sqlite3ota*, int bOta);
 
 /*
 ** Do some work towards applying the OTA update to the target db. 
index bbb52fe0d904519a8daa3d14613e035c7a97b6ec..601453e1296ab9adc22e30d5111721ae7dcd7a75 100644 (file)
@@ -94,7 +94,7 @@ static int test_sqlite3ota_cmd(
     }
 
     case 2: /* create_ota_delta */ {
-      sqlite3 *db = sqlite3ota_db(pOta);
+      sqlite3 *db = sqlite3ota_db(pOta, 0);
       int rc = sqlite3_create_function(
           db, "ota_delta", -1, SQLITE_UTF8, (void*)interp, test_ota_delta, 0, 0
       );
@@ -211,9 +211,9 @@ static int test_sqlite3ota_internal_test(
     return TCL_ERROR;
   }
 
-  db = sqlite3ota_db(0);
+  db = sqlite3ota_db(0, 0);
   if( db!=0 ){
-    Tcl_AppendResult(interp, "sqlite3ota_db(0)!=0", 0);
+    Tcl_AppendResult(interp, "sqlite3ota_db(0, 0)!=0", 0);
     return TCL_ERROR;
   }
 
index 3e7fe6ced6478c869415e842c798ab6cd76329c1..da076decb22d330573ac8eb3a43010c18375e327 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Improve\stests\sfor\sresuming\sota\supdates\sfollowing\spower\sfailures.\sFix\sa\sproblem\srevealed\sby\sthe\ssame.
-D 2015-02-23T12:22:55.407
+C Update\sthe\ssqlite3ota_db()\sAPI\sto\saccount\sfor\sthe\sfact\sthat\seach\sOTA\shandle\snow\suses\stwo\sSQLite\sdatabase\shandles.
+D 2015-02-23T15:02:13.758
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 6b9e7677829aa94b9f30949656e27312aefb9a46
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -138,9 +138,9 @@ F ext/ota/otaA.test ef4bfa8cfd4ed814ae86f7457b64aa2f18c90171
 F ext/ota/otacrash.test a078d34e2edbcedac5f894e3e7d08d452a327007
 F ext/ota/otafault.test 8c43586c2b96ca16bbce00b5d7e7d67316126db8
 F ext/ota/otafault2.test fa202a98ca221faec318f3e5c5f39485b1256561
-F ext/ota/sqlite3ota.c 7949ecd5b100da558a073bc7800971e3da822fb2
-F ext/ota/sqlite3ota.h 052d87068751810a9dfba1a48954271501bb728f
-F ext/ota/test_ota.c 9ec6ea945282f65f67f0e0468dad79a489818f44
+F ext/ota/sqlite3ota.c fa63725a85c1208c9e469efc3df18798a12c1cd5
+F ext/ota/sqlite3ota.h 4cd82fbac9cbea89bd51edace3ec5c57866c02e3
+F ext/ota/test_ota.c e34c801c665d64b4b9e00b71f1acf8c652404b2b
 F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
 F ext/rtree/rtree.c 14e6239434d4e3f65d3e90320713f26aa24e167f
 F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
@@ -1258,7 +1258,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 6d5ed70d0dbabe9c2ab2f2dba47747d17d937781
-R 4c48a15e3fb052167c1c2cb6db2c19fe
+P 1cb675e5392f179516d8e7a52760922a6c7df4d0
+R a9177f7d92fc75d9eccc7912836972e5
 U dan
-Z 4ecb7af4e3b45df7793dc31c4cb806df
+Z 89f5d620618d356804404be134f86324
index 2e369faa1bebea65a231d4e3edcca5aeb94b8203..e2e7546f5756a871d628cebf6d60132e44239db7 100644 (file)
@@ -1 +1 @@
-1cb675e5392f179516d8e7a52760922a6c7df4d0
\ No newline at end of file
+ef08ecceb7e237a01af6cc3141dccee09ffe9ae3
\ No newline at end of file