-C Merge\slatest\strunk\schanges\sinto\sthis\sbranch.
-D 2018-09-04T18:23:59.058
+C Fix\sminor\scode\sissues\sin\salter.c.
+D 2018-09-05T08:28:30.162
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in 6b650013511fd9d8b094203ac268af9220d292cc7d4e1bc9fbca15aacd8c7995
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
-F src/alter.c 8e6fc7ba56710f58cfaa3212cc059bdfde0100b8825cecace0d6a96b0c57c997
+F src/alter.c 03195c21c23ee260bc37a94ed971647fc61522a318499dec712c035065327248
F src/analyze.c 3dc6b98cf007b005af89df165c966baaa48e8124f38c87b4d2b276fe7f0b9eb9
F src/attach.c 4bd5b92633671d3e8ce431153ebb1893b50335818423b5373f3f27969f79769a
F src/auth.c 32a5bbe3b755169ab6c66311c5225a3cd4f75a46c041f7fb117e0cbb68055114
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 6805b5900df5e6d3329cbad2660875ebe4069efe37b19575f527d153dc0882a1 f1138a38bd23f201a35621a71e82c5718abddb42ab82938e9516ab9d43e4df16
-R e8730623bb58ce7069d342aaf0307c8b
+P ef9e088290efa9d0fc36bcdef710cadfef37c8a33f4685dad4ce113807e1cc75
+R 3c73ae7419c717f5dc619ede5bd8da02
U dan
-Z 2ab7bdc7b709a6325ea8ef14f7ff4ef1
+Z 6d8c724be6bb52b55bc9a3322b139f49
}
}
+/*
+** Parse the SQL statement zSql using Parse object (*p). The Parse object
+** is initialized by this function before it is used.
+*/
static int renameParseSql(
- Parse *p,
- const char *zDb,
- int bTable,
- sqlite3 *db,
- const char *zSql,
- int bTemp
+ Parse *p, /* Memory to use for Parse object */
+ const char *zDb, /* Name of schema SQL belongs to */
+ int bTable, /* 1 -> RENAME TABLE, 0 -> RENAME COLUMN */
+ sqlite3 *db, /* Database handle */
+ const char *zSql, /* SQL to parse */
+ int bTemp /* True if SQL is from temp schema */
){
int rc;
char *zErr = 0;
return rc;
}
+/*
+** This function edits SQL statement zSql, replacing each token identified
+** by the linked list pRename with the text of zNew. If argument bQuote is
+** true, then zNew is always quoted first. If no error occurs, the result
+** is loaded into context object pCtx as the result.
+**
+** Or, if an error occurs (i.e. an OOM condition), an error is left in
+** pCtx and an SQLite error code returned.
+*/
static int renameEditSql(
sqlite3_context *pCtx, /* Return result here */
RenameCtx *pRename, /* Rename context */
return rc;
}
-static int renameResolveTrigger(
- Parse *pParse,
- const char *zDb
-){
+/*
+** Resolve all symbols in the trigger at pParse->pNewTrigger, assuming
+** it was read from the schema of database zDb. Return SQLITE_OK if
+** successful. Otherwise, return an SQLite error code and leave an error
+** message in the Parse object.
+*/
+static int renameResolveTrigger(Parse *pParse, const char *zDb){
sqlite3 *db = pParse->db;
TriggerStep *pStep;
NameContext sNC;
return rc;
}
+/*
+** Invoke sqlite3WalkExpr() or sqlite3WalkSelect() on all Select or Expr
+** objects that are part of the trigger passed as the second argument.
+*/
static void renameWalkTrigger(Walker *pWalker, Trigger *pTrigger){
TriggerStep *pStep;
}
}
+/*
+** Free the contents of Parse object (*pParse). Do not free the memory
+** occupied by the Parse object itself.
+*/
static void renameParseCleanup(Parse *pParse){
sqlite3 *db = pParse->db;
if( pParse->pVdbe ){
sqlite3BtreeLeaveAll(db);
}
+/*
+** Walker expression callback used by "RENAME TABLE".
+*/
static int renameTableExprCb(Walker *pWalker, Expr *pExpr){
RenameCtx *p = pWalker->u.pRename;
if( pExpr->op==TK_COLUMN && p->pTab==pExpr->pTab ){
}
/*
-** This is a Walker select callback.
+** Walker select callback used by "RENAME TABLE".
*/
static int renameTableSelectCb(Walker *pWalker, Select *pSelect){
int i;
return;
}
+/*
+** An SQL user function that checks that there are no parse or symbol
+** resolution problems in a CREATE TRIGGER|TABLE|VIEW|INDEX statement.
+** After an ALTER TABLE .. RENAME operation is performed and the schema
+** reloaded, this function is called on each SQL statement in the schema
+** to ensure that it are still usable.
+**
+** 0: Database name ("main", "temp" etc.).
+** 1: SQL statement.
+** 2: Object type ("view", "table", "trigger" or "index").
+** 3: Object name.
+** 4: True if object is from temp schema.
+*/
static void renameTableTest(
sqlite3_context *context,
int NotUsed,