diff options
author | dan <dan@noemail.net> | 2015-02-23 15:02:13 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2015-02-23 15:02:13 +0000 |
commit | 5ebc83b1d2f9fa42a26f853eacfe00d826ea27fc (patch) | |
tree | 6f495334a3fae6cb11f3d675c512e898f3f5e5f2 | |
parent | 882b8e09746dcdbdd4a9cc2479bad25ae6ebc6ad (diff) | |
download | sqlite-5ebc83b1d2f9fa42a26f853eacfe00d826ea27fc.tar.gz sqlite-5ebc83b1d2f9fa42a26f853eacfe00d826ea27fc.zip |
Update the sqlite3ota_db() API to account for the fact that each OTA handle now uses two SQLite database handles.
FossilOrigin-Name: ef08ecceb7e237a01af6cc3141dccee09ffe9ae3
-rw-r--r-- | ext/ota/sqlite3ota.c | 8 | ||||
-rw-r--r-- | ext/ota/sqlite3ota.h | 27 | ||||
-rw-r--r-- | ext/ota/test_ota.c | 6 | ||||
-rw-r--r-- | manifest | 16 | ||||
-rw-r--r-- | manifest.uuid | 2 |
5 files changed, 35 insertions, 24 deletions
diff --git a/ext/ota/sqlite3ota.c b/ext/ota/sqlite3ota.c index d2f8d99ec..369f035e4 100644 --- a/ext/ota/sqlite3ota.c +++ b/ext/ota/sqlite3ota.c @@ -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; } diff --git a/ext/ota/sqlite3ota.h b/ext/ota/sqlite3ota.h index 814cd7f0e..ed5f652c2 100644 --- a/ext/ota/sqlite3ota.h +++ b/ext/ota/sqlite3ota.h @@ -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. diff --git a/ext/ota/test_ota.c b/ext/ota/test_ota.c index bbb52fe0d..601453e12 100644 --- a/ext/ota/test_ota.c +++ b/ext/ota/test_ota.c @@ -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; } @@ -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 diff --git a/manifest.uuid b/manifest.uuid index 2e369faa1..e2e7546f5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1cb675e5392f179516d8e7a52760922a6c7df4d0
\ No newline at end of file +ef08ecceb7e237a01af6cc3141dccee09ffe9ae3
\ No newline at end of file |