SQLite

Check-in [c573b0a1aa]
Login

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

Overview
Comment:Simplification to error handling in addModuleArgument() in the virtual table processing.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c573b0a1aa3ba509234f07520fa94d008bcbb330
User & Date: drh 2015-08-19 12:45:57.389
Context
2015-08-20
17:18
Make SQLITE_BUSY_SNAPSHOT and SQLITE_BUSY_RECOVERY retryable, just as a plain SQLITE_BUSY is. (check-in: fd13dd950d user: drh tags: trunk)
2015-08-19
12:52
Merge changes from trunk. (check-in: dddd792ded user: drh tags: table-valued-functions)
12:45
Simplification to error handling in addModuleArgument() in the virtual table processing. (check-in: c573b0a1aa user: drh tags: trunk)
08:34
When updating a zipvfs database with RBU, set journal_mode=off to prevent the upper-level pager from creating a large temporary file. (check-in: dec14a3980 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/vtab.c.
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300

301
302
303
304

305
306
307
308
309
310
311
/*
** Add a new module argument to pTable->azModuleArg[].
** The string is not copied - the pointer is stored.  The
** string will be freed automatically when the table is
** deleted.
*/
static void addModuleArgument(sqlite3 *db, Table *pTable, char *zArg){
  int i = pTable->nModuleArg++;
  int nBytes = sizeof(char *)*(1+pTable->nModuleArg);
  char **azModuleArg;
  azModuleArg = sqlite3DbRealloc(db, pTable->azModuleArg, nBytes);
  if( azModuleArg==0 ){
    int j;
    for(j=0; j<i; j++){
      sqlite3DbFree(db, pTable->azModuleArg[j]);
    }
    sqlite3DbFree(db, zArg);
    sqlite3DbFree(db, pTable->azModuleArg);
    pTable->nModuleArg = 0;
  }else{

    azModuleArg[i] = zArg;
    azModuleArg[i+1] = 0;
  }
  pTable->azModuleArg = azModuleArg;

}

/*
** The parser calls this routine when it first sees a CREATE VIRTUAL TABLE
** statement.  The module name has been parsed, but the optional list
** of parameters that follow the module name are still pending.
*/







<
|



<
<
<
<

<
<

>


<
|
>







281
282
283
284
285
286
287

288
289
290
291




292


293
294
295
296

297
298
299
300
301
302
303
304
305
/*
** Add a new module argument to pTable->azModuleArg[].
** The string is not copied - the pointer is stored.  The
** string will be freed automatically when the table is
** deleted.
*/
static void addModuleArgument(sqlite3 *db, Table *pTable, char *zArg){

  int nBytes = sizeof(char *)*(2+pTable->nModuleArg);
  char **azModuleArg;
  azModuleArg = sqlite3DbRealloc(db, pTable->azModuleArg, nBytes);
  if( azModuleArg==0 ){




    sqlite3DbFree(db, zArg);


  }else{
    int i = pTable->nModuleArg++;
    azModuleArg[i] = zArg;
    azModuleArg[i+1] = 0;

    pTable->azModuleArg = azModuleArg;
  }
}

/*
** The parser calls this routine when it first sees a CREATE VIRTUAL TABLE
** statement.  The module name has been parsed, but the optional list
** of parameters that follow the module name are still pending.
*/