/ Check-in [c74e0bc4]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Remove the sqlite3ota_open_v2() API. Add a new parameter to sqlite3ota_open() instead.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c74e0bc481ce995f83ca8384e05dfbe068a0ae85
User & Date: dan 2015-05-19 17:48:11
Context
2015-05-19
19:44
Ensure that when the VM applies TEXT affinity to a value it discards any existing REAL or INTEGER value. Fix for [34cd55d6]. check-in: f5d0ce80 user: dan tags: trunk
17:48
Remove the sqlite3ota_open_v2() API. Add a new parameter to sqlite3ota_open() instead. check-in: c74e0bc4 user: dan tags: trunk
16:50
Merge the ota-update branch with trunk. check-in: 08e2864e user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/ota/sqlite3ota.c.

  2656   2656   static void otaDeleteVfs(sqlite3ota *p){
  2657   2657     if( p->zVfsName ){
  2658   2658       sqlite3ota_destroy_vfs(p->zVfsName);
  2659   2659       p->zVfsName = 0;
  2660   2660     }
  2661   2661   }
  2662   2662   
  2663         -static sqlite3ota *otaOpen(
         2663  +/*
         2664  +** Open and return a new OTA handle. 
         2665  +*/
         2666  +sqlite3ota *sqlite3ota_open(
  2664   2667     const char *zTarget, 
  2665   2668     const char *zOta,
  2666   2669     const char *zState
  2667   2670   ){
  2668   2671     sqlite3ota *p;
  2669   2672     int nTarget = strlen(zTarget);
  2670   2673     int nOta = strlen(zOta);
................................................................................
  2772   2775       otaFreeState(pState);
  2773   2776     }
  2774   2777   
  2775   2778     return p;
  2776   2779   }
  2777   2780   
  2778   2781   
  2779         -/*
  2780         -** Open and return a new OTA handle. 
  2781         -*/
  2782         -sqlite3ota *sqlite3ota_open_v2(
  2783         -  const char *zDb, 
  2784         -  const char *zOta, 
  2785         -  const char *zState
  2786         -){
  2787         -  return otaOpen(zDb, zOta, zState);
  2788         -}
  2789         -
  2790         -/*
  2791         -** Open and return a new OTA handle. 
  2792         -*/
  2793         -sqlite3ota *sqlite3ota_open(
  2794         -  const char *zDb, 
  2795         -  const char *zOta 
  2796         -){
  2797         -  return otaOpen(zDb, zOta, 0);
  2798         -}
  2799         -
  2800   2782   /*
  2801   2783   ** Return the database handle used by pOta.
  2802   2784   */
  2803   2785   sqlite3 *sqlite3ota_db(sqlite3ota *pOta, int bOta){
  2804   2786     sqlite3 *db = 0;
  2805   2787     if( pOta ){
  2806   2788       db = (bOta ? pOta->dbOta : pOta->dbMain);

Changes to ext/ota/sqlite3ota.h.

   257    257   ** Argument zTarget is the path to the target database. Argument zOta is
   258    258   ** the path to the OTA database. Each call to this function must be matched
   259    259   ** by a call to sqlite3ota_close(). When opening the databases, OTA passes
   260    260   ** the SQLITE_CONFIG_URI flag to sqlite3_open_v2(). So if either zTarget
   261    261   ** or zOta begin with "file:", it will be interpreted as an SQLite 
   262    262   ** database URI, not a regular file name.
   263    263   **
          264  +** If the zState argument is passed a NULL value, the OTA extension stores 
          265  +** the current state of the update (how many rows have been updated, which 
          266  +** indexes are yet to be updated etc.) within the OTA database itself. This
          267  +** can be convenient, as it means that the OTA application does not need to
          268  +** organize removing a separate state file after the update is concluded. 
          269  +** Or, if zState is non-NULL, it must be a path to a database file in which 
          270  +** the OTA extension can store the state of the update.
          271  +**
          272  +** When resuming an OTA update, the zState argument must be passed the same
          273  +** value as when the OTA update was started.
          274  +**
          275  +** Once the OTA update is finished, the OTA extension does not 
          276  +** automatically remove any zState database file, even if it created it.
          277  +**
   264    278   ** By default, OTA uses the default VFS to access the files on disk. To
   265    279   ** use a VFS other than the default, an SQLite "file:" URI containing a
   266    280   ** "vfs=..." option may be passed as the zTarget option.
   267    281   **
   268    282   ** IMPORTANT NOTE FOR ZIPVFS USERS: The OTA extension works with all of
   269    283   ** SQLite's built-in VFSs, including the multiplexor VFS. However it does
   270    284   ** not work out of the box with zipvfs. Refer to the comment describing
   271    285   ** the zipvfs_create_vfs() API below for details on using OTA with zipvfs.
   272    286   */
   273         -sqlite3ota *sqlite3ota_open(const char *zTarget, const char *zOta);
   274         -
   275         -/*
   276         -** Open an OTA handle with an auxiliary state file.
   277         -**
   278         -** This API is similar to sqlite3ota_open(), except that it allows the user 
   279         -** to specify a separate SQLite database in which to store the OTA update 
   280         -** state.
   281         -**
   282         -** While executing, the OTA extension usually stores the current state 
   283         -** of the update (how many rows have been updated, which indexes are yet
   284         -** to be updated etc.) within the OTA database itself. This can be 
   285         -** convenient, as it means that the OTA application does not need to
   286         -** organize removing a separate state file after the update is concluded.
   287         -** However, it can also be inconvenient - for example if the OTA update
   288         -** database is sto be stored on a read-only media.
   289         -**
   290         -** If an OTA update started using a handle opened with this function is
   291         -** suspended, the application must use this function to resume it, and 
   292         -** must pass the same zState argument each time the update is resumed.
   293         -** Attempting to resume an sqlite3ota_open_v2() update using sqlite3ota_open(),
   294         -** or with a call to sqlite3ota_open_v2() specifying a different zState
   295         -** argument leads to undefined behaviour.
   296         -**
   297         -** Once the OTA update is finished, the OTA extension does not 
   298         -** automatically remove the zState database file, even if it created it.
   299         -*/
   300         -sqlite3ota *sqlite3ota_open_v2(
   301         -  const char *zTarget,
          287  +sqlite3ota *sqlite3ota_open(
          288  +  const char *zTarget, 
   302    289     const char *zOta,
   303    290     const char *zState
   304    291   );
   305    292   
   306    293   /*
   307    294   ** Internally, each OTA connection uses a separate SQLite database 
   308    295   ** connection to access the target and ota update databases. This

Changes to ext/ota/test_ota.c.

   120    120     int objc,
   121    121     Tcl_Obj *CONST objv[]
   122    122   ){
   123    123     sqlite3ota *pOta = 0;
   124    124     const char *zCmd;
   125    125     const char *zTarget;
   126    126     const char *zOta;
          127  +  const char *zStateDb = 0;
   127    128   
   128    129     if( objc!=4 && objc!=5 ){
   129    130       Tcl_WrongNumArgs(interp, 1, objv, "NAME TARGET-DB OTA-DB ?STATE-DB?");
   130    131       return TCL_ERROR;
   131    132     }
   132    133     zCmd = Tcl_GetString(objv[1]);
   133    134     zTarget = Tcl_GetString(objv[2]);
   134    135     zOta = Tcl_GetString(objv[3]);
          136  +  if( objc==5 ) zStateDb = Tcl_GetString(objv[4]);
   135    137   
   136         -  if( objc==4 ){
   137         -    pOta = sqlite3ota_open(zTarget, zOta);
   138         -  }else{
   139         -    const char *zStateDb = Tcl_GetString(objv[4]);
   140         -    pOta = sqlite3ota_open_v2(zTarget, zOta, zStateDb);
   141         -  }
          138  +  pOta = sqlite3ota_open(zTarget, zOta, zStateDb);
   142    139     Tcl_CreateObjCommand(interp, zCmd, test_sqlite3ota_cmd, (ClientData)pOta, 0);
   143    140     Tcl_SetObjResult(interp, objv[1]);
   144    141     return TCL_OK;
   145    142   }
   146    143   
   147    144   /*
   148    145   ** Tclcmd: sqlite3ota_create_vfs ?-default? NAME PARENT