SQLite

Check-in [bfc4e7f30e]
Login

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

Overview
Comment:Minor code simplification in the ALTER TABLE logic.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: bfc4e7f30e4654b9603457fb6a4136828e346dcfe4e313fdf56ed62d131b7156
User & Date: drh 2017-06-28 01:12:53.264
Context
2017-06-28
01:21
Simplify error handling logic in sqlite3_exec() to save about 40 bytes. (check-in: 6480916c72 user: drh tags: trunk)
01:12
Minor code simplification in the ALTER TABLE logic. (check-in: bfc4e7f30e user: drh tags: trunk)
00:55
Avoid an unnecessary call to sqlite3XPrintf() in the code generator, for a performance improvement. (check-in: 29d6ceb383 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/alter.c.
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
** (either with ALTER TABLE ... RENAME TO or ALTER TABLE ... ADD COLUMN).
** If the table is a system table, this function leaves an error message
** in pParse->zErr (system tables may not be altered) and returns non-zero.
**
** Or, if zName is not a system table, zero is returned.
*/
static int isSystemTable(Parse *pParse, const char *zName){
  if( sqlite3Strlen30(zName)>6 && 0==sqlite3StrNICmp(zName, "sqlite_", 7) ){
    sqlite3ErrorMsg(pParse, "table %s may not be altered", zName);
    return 1;
  }
  return 0;
}

/*







|







371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
** (either with ALTER TABLE ... RENAME TO or ALTER TABLE ... ADD COLUMN).
** If the table is a system table, this function leaves an error message
** in pParse->zErr (system tables may not be altered) and returns non-zero.
**
** Or, if zName is not a system table, zero is returned.
*/
static int isSystemTable(Parse *pParse, const char *zName){
  if( 0==sqlite3StrNICmp(zName, "sqlite_", 7) ){
    sqlite3ErrorMsg(pParse, "table %s may not be altered", zName);
    return 1;
  }
  return 0;
}

/*