From 815bd625c2d340528fd6779aeb5e946cd8ea12d2 Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 19 May 2015 17:48:11 +0000 Subject: [PATCH] Remove the sqlite3ota_open_v2() API. Add a new parameter to sqlite3ota_open() instead. FossilOrigin-Name: c74e0bc481ce995f83ca8384e05dfbe068a0ae85 --- ext/ota/sqlite3ota.c | 26 ++++--------------------- ext/ota/sqlite3ota.h | 45 ++++++++++++++++---------------------------- ext/ota/test_ota.c | 9 +++------ manifest | 16 ++++++++-------- manifest.uuid | 2 +- 5 files changed, 32 insertions(+), 66 deletions(-) diff --git a/ext/ota/sqlite3ota.c b/ext/ota/sqlite3ota.c index e365de4fe3..7fa52b2051 100644 --- a/ext/ota/sqlite3ota.c +++ b/ext/ota/sqlite3ota.c @@ -2660,7 +2660,10 @@ static void otaDeleteVfs(sqlite3ota *p){ } } -static sqlite3ota *otaOpen( +/* +** Open and return a new OTA handle. +*/ +sqlite3ota *sqlite3ota_open( const char *zTarget, const char *zOta, const char *zState @@ -2776,27 +2779,6 @@ static sqlite3ota *otaOpen( } -/* -** Open and return a new OTA handle. -*/ -sqlite3ota *sqlite3ota_open_v2( - const char *zDb, - const char *zOta, - const char *zState -){ - return otaOpen(zDb, zOta, zState); -} - -/* -** Open and return a new OTA handle. -*/ -sqlite3ota *sqlite3ota_open( - const char *zDb, - const char *zOta -){ - return otaOpen(zDb, zOta, 0); -} - /* ** Return the database handle used by pOta. */ diff --git a/ext/ota/sqlite3ota.h b/ext/ota/sqlite3ota.h index 2b55fb2795..a255611ea8 100644 --- a/ext/ota/sqlite3ota.h +++ b/ext/ota/sqlite3ota.h @@ -261,6 +261,20 @@ typedef struct sqlite3ota sqlite3ota; ** or zOta begin with "file:", it will be interpreted as an SQLite ** database URI, not a regular file name. ** +** If the zState argument is passed a NULL value, the OTA extension stores +** the current state of the update (how many rows have been updated, which +** indexes are yet to be updated etc.) within the OTA database itself. This +** can be convenient, as it means that the OTA application does not need to +** organize removing a separate state file after the update is concluded. +** Or, if zState is non-NULL, it must be a path to a database file in which +** the OTA extension can store the state of the update. +** +** When resuming an OTA update, the zState argument must be passed the same +** value as when the OTA update was started. +** +** Once the OTA update is finished, the OTA extension does not +** automatically remove any zState database file, even if it created it. +** ** By default, OTA uses the default VFS to access the files on disk. To ** use a VFS other than the default, an SQLite "file:" URI containing a ** "vfs=..." option may be passed as the zTarget option. @@ -270,35 +284,8 @@ typedef struct sqlite3ota sqlite3ota; ** not work out of the box with zipvfs. Refer to the comment describing ** the zipvfs_create_vfs() API below for details on using OTA with zipvfs. */ -sqlite3ota *sqlite3ota_open(const char *zTarget, const char *zOta); - -/* -** Open an OTA handle with an auxiliary state file. -** -** This API is similar to sqlite3ota_open(), except that it allows the user -** to specify a separate SQLite database in which to store the OTA update -** state. -** -** While executing, the OTA extension usually stores the current state -** of the update (how many rows have been updated, which indexes are yet -** to be updated etc.) within the OTA database itself. This can be -** convenient, as it means that the OTA application does not need to -** organize removing a separate state file after the update is concluded. -** However, it can also be inconvenient - for example if the OTA update -** database is sto be stored on a read-only media. -** -** If an OTA update started using a handle opened with this function is -** suspended, the application must use this function to resume it, and -** must pass the same zState argument each time the update is resumed. -** Attempting to resume an sqlite3ota_open_v2() update using sqlite3ota_open(), -** or with a call to sqlite3ota_open_v2() specifying a different zState -** argument leads to undefined behaviour. -** -** Once the OTA update is finished, the OTA extension does not -** automatically remove the zState database file, even if it created it. -*/ -sqlite3ota *sqlite3ota_open_v2( - const char *zTarget, +sqlite3ota *sqlite3ota_open( + const char *zTarget, const char *zOta, const char *zState ); diff --git a/ext/ota/test_ota.c b/ext/ota/test_ota.c index f2370ad9a7..33ef634030 100644 --- a/ext/ota/test_ota.c +++ b/ext/ota/test_ota.c @@ -124,6 +124,7 @@ static int test_sqlite3ota( const char *zCmd; const char *zTarget; const char *zOta; + const char *zStateDb = 0; if( objc!=4 && objc!=5 ){ Tcl_WrongNumArgs(interp, 1, objv, "NAME TARGET-DB OTA-DB ?STATE-DB?"); @@ -132,13 +133,9 @@ static int test_sqlite3ota( zCmd = Tcl_GetString(objv[1]); zTarget = Tcl_GetString(objv[2]); zOta = Tcl_GetString(objv[3]); + if( objc==5 ) zStateDb = Tcl_GetString(objv[4]); - if( objc==4 ){ - pOta = sqlite3ota_open(zTarget, zOta); - }else{ - const char *zStateDb = Tcl_GetString(objv[4]); - pOta = sqlite3ota_open_v2(zTarget, zOta, zStateDb); - } + pOta = sqlite3ota_open(zTarget, zOta, zStateDb); Tcl_CreateObjCommand(interp, zCmd, test_sqlite3ota_cmd, (ClientData)pOta, 0); Tcl_SetObjResult(interp, objv[1]); return TCL_OK; diff --git a/manifest b/manifest index 7c928da597..d6ba39cec2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\sthe\sota-update\sbranch\swith\strunk. -D 2015-05-19T16:50:18.742 +C Remove\sthe\ssqlite3ota_open_v2()\sAPI.\sAdd\sa\snew\sparameter\sto\ssqlite3ota_open()\sinstead. +D 2015-05-19T17:48:11.466 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 0a6ae26396ec696221021780dffbb894ff3cead7 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -139,9 +139,9 @@ F ext/ota/otaA.test ab67f7f53670b81c750dcc946c5b704f51c429a4 F ext/ota/otacrash.test 8346192b2d46cbe7787d5d65904d81d3262a3cbf F ext/ota/otafault.test 8c43586c2b96ca16bbce00b5d7e7d67316126db8 F ext/ota/otafault2.test fa202a98ca221faec318f3e5c5f39485b1256561 -F ext/ota/sqlite3ota.c 89530008cff5825072ef455eb45cf04d497d6399 -F ext/ota/sqlite3ota.h ebde09505ccfff78def3c67b02cfebe27f830925 -F ext/ota/test_ota.c ba5d936190713d15919502d6ee6f287cada279ae +F ext/ota/sqlite3ota.c 2246b779f46ab20d5e7876f5b96c378c601d20f4 +F ext/ota/sqlite3ota.h 00028de37eede471ff1947d455cc3f33d3a911c6 +F ext/ota/test_ota.c a876f88550d7d59a3ef62d4c1a5c04c4c2f1ebe1 F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761 F ext/rtree/rtree.c 0c207fd8b814a35537d96681cbf57436e200b75e F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e @@ -1278,7 +1278,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 5df4056448fee1c766f8f79c735ed12abdce5101 efa20f8e41e9370f419f055efa941a8521c68c86 -R 90f51428989ad97de8b5b492628ddcf2 +P 08e2864ed7c2d36410a248459061dcbd5576e145 +R d09494068161087db80612c39a639a87 U dan -Z c66936b8d4c1f56a0c4fa9f1d6ac6c57 +Z 59d2caf8980d2c8a59e31483a39f217a diff --git a/manifest.uuid b/manifest.uuid index f191118f13..822761ba14 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -08e2864ed7c2d36410a248459061dcbd5576e145 \ No newline at end of file +c74e0bc481ce995f83ca8384e05dfbe068a0ae85 \ No newline at end of file