-C Add\sa\sheader\scomment\sto\sthe\ssearchWith()\sroutine.
-D 2014-01-15T18:23:00.349
+C Further\scomments\son\sWITH-clause\sprocessing\sroutines\sin\sselect.c.
+D 2014-01-15T18:35:52.482
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece
F src/resolve.c 41d0cf644aa98131204e6243e108829797f038ab
F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
-F src/select.c 240e9795df3fbaca15e2fa9c3b0a95796e60e5d7
+F src/select.c 6bdb90db59e3e8277b8953e4cd3df01ccc253d70
F src/shell.c a3541193d5fce37e91dad8ef46a9505aa7c9b344
F src/sqlite.h.in d94a8b89522f526ba711182ee161e06f8669bcc9
F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e
F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc
-F src/sqliteInt.h 31bcde5190ca666e4873188a9039ac6ff017a0a8
+F src/sqliteInt.h d91991457386b4a1414fa96f51a9a5bfd2b8606d
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
F src/status.c 7ac05a5c7017d0b9f0b4bcd701228b784f987158
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
-P 28aa6db8c878655255dbfb618f8d65be78e3d7e5
-R 19b67b003a2571a98d1dce07a86e95af
+P d9ae0f5d9f8230ca7ca10ebed300e2f6635a0614
+R de20d9dcfc2fdd09cc5e9c05dc6deb70
U drh
-Z 5c4be2977b3d2e13595e058b593ca068
+Z 626093c1115d7d3f00c431f06f508aa1
-d9ae0f5d9f8230ca7ca10ebed300e2f6635a0614
\ No newline at end of file
+c948384dfdd9f68a832d5a452af44f35337f66e7
\ No newline at end of file
return WRC_Continue;
}
-/* If the table identified by p is a transient table of
+/* If the table identified by FROM clause element p is really
** a common-table-expression (CTE) then return a pointer to the
-** CTE that defines table p. If p is not a CTE, then return NULL.
+** CTE definition for that table.
*/
static struct Cte *searchWith(Parse *pParse, struct SrcList_item *p){
if( p->zDatabase==0 ){
return 0;
}
+/* The code generator maintains a stack of active WITH clauses
+** with the inner-most WITH clause being at the top of the stack.
+**
+** These routines push and pull WITH clauses on the stack.
+*/
void sqlite3WithPush(Parse *pParse, With *pWith){
if( pWith ){
pWith->pOuter = pParse->pWith;
}
}
+/* Push or pull a CTE on the stack of all CTEs currently being
+** coded.
+*/
static int ctePush(Parse *pParse, struct Cte *pCte){
if( pCte ){
struct Cte *p;
}
return SQLITE_OK;
}
-
static void ctePop(Parse *pParse, struct Cte *pCte){
if( pCte ){
assert( pParse->pCte==pCte );
#define WRC_Abort 2 /* Abandon the tree walk */
/*
-** An instance of this structure represents a set of CTEs (common table
-** expressions) created by a single WITH clause.
+** An instance of this structure represents a set of on or more CTEs
+** (common table expressions) created by a single WITH clause.
*/
struct With {
- int nCte; /* Number of CTEs */
+ int nCte; /* Number of CTEs in the WITH clause */
With *pOuter; /* Containing WITH clause, or NULL */
- struct Cte {
- char *zName; /* Name of this CTE */
- ExprList *pCols; /* List of explicit column names, or NULL */
- Select *pSelect; /* The contents of the CTE */
- struct Cte *pOuterCte;
- Table *pTab;
+ struct Cte { /* For each CTE in the WITH clause.... */
+ char *zName; /* Name of this CTE */
+ ExprList *pCols; /* List of explicit column names, or NULL */
+ Select *pSelect; /* The definition of this CTE */
+ struct Cte *pOuterCte; /* Next WITH clause in outer context */
+ Table *pTab; /* Table object for this CTE */
} a[1];
};