mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Further comments on WITH-clause processing routines in select.c.
FossilOrigin-Name: c948384dfdd9f68a832d5a452af44f35337f66e7
This commit is contained in:
14
manifest
14
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Add\sa\sheader\scomment\sto\sthe\ssearchWith()\sroutine.
|
C Further\scomments\son\sWITH-clause\sprocessing\sroutines\sin\sselect.c.
|
||||||
D 2014-01-15T18:23:00.349
|
D 2014-01-15T18:35:52.482
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
|
F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -219,12 +219,12 @@ F src/printf.c 85d07756e45d7496d19439dcae3e6e9e0090f269
|
|||||||
F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece
|
F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece
|
||||||
F src/resolve.c 41d0cf644aa98131204e6243e108829797f038ab
|
F src/resolve.c 41d0cf644aa98131204e6243e108829797f038ab
|
||||||
F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
|
F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
|
||||||
F src/select.c 240e9795df3fbaca15e2fa9c3b0a95796e60e5d7
|
F src/select.c 6bdb90db59e3e8277b8953e4cd3df01ccc253d70
|
||||||
F src/shell.c a3541193d5fce37e91dad8ef46a9505aa7c9b344
|
F src/shell.c a3541193d5fce37e91dad8ef46a9505aa7c9b344
|
||||||
F src/sqlite.h.in d94a8b89522f526ba711182ee161e06f8669bcc9
|
F src/sqlite.h.in d94a8b89522f526ba711182ee161e06f8669bcc9
|
||||||
F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e
|
F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e
|
||||||
F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc
|
F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc
|
||||||
F src/sqliteInt.h 31bcde5190ca666e4873188a9039ac6ff017a0a8
|
F src/sqliteInt.h d91991457386b4a1414fa96f51a9a5bfd2b8606d
|
||||||
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
|
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
|
||||||
F src/status.c 7ac05a5c7017d0b9f0b4bcd701228b784f987158
|
F src/status.c 7ac05a5c7017d0b9f0b4bcd701228b784f987158
|
||||||
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
|
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
|
||||||
@@ -1150,7 +1150,7 @@ F tool/vdbe-compress.tcl 0cf56e9263a152b84da86e75a5c0cdcdb7a47891
|
|||||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||||
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
|
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
|
||||||
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
|
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
|
||||||
P 28aa6db8c878655255dbfb618f8d65be78e3d7e5
|
P d9ae0f5d9f8230ca7ca10ebed300e2f6635a0614
|
||||||
R 19b67b003a2571a98d1dce07a86e95af
|
R de20d9dcfc2fdd09cc5e9c05dc6deb70
|
||||||
U drh
|
U drh
|
||||||
Z 5c4be2977b3d2e13595e058b593ca068
|
Z 626093c1115d7d3f00c431f06f508aa1
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
d9ae0f5d9f8230ca7ca10ebed300e2f6635a0614
|
c948384dfdd9f68a832d5a452af44f35337f66e7
|
||||||
13
src/select.c
13
src/select.c
@@ -3482,9 +3482,9 @@ static int convertCompoundSelectToSubquery(Walker *pWalker, Select *p){
|
|||||||
return WRC_Continue;
|
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
|
** 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){
|
static struct Cte *searchWith(Parse *pParse, struct SrcList_item *p){
|
||||||
if( p->zDatabase==0 ){
|
if( p->zDatabase==0 ){
|
||||||
@@ -3503,6 +3503,11 @@ static struct Cte *searchWith(Parse *pParse, struct SrcList_item *p){
|
|||||||
return 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){
|
void sqlite3WithPush(Parse *pParse, With *pWith){
|
||||||
if( pWith ){
|
if( pWith ){
|
||||||
pWith->pOuter = pParse->pWith;
|
pWith->pOuter = pParse->pWith;
|
||||||
@@ -3516,6 +3521,9 @@ static void withPop(Parse *pParse, With *pWith){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Push or pull a CTE on the stack of all CTEs currently being
|
||||||
|
** coded.
|
||||||
|
*/
|
||||||
static int ctePush(Parse *pParse, struct Cte *pCte){
|
static int ctePush(Parse *pParse, struct Cte *pCte){
|
||||||
if( pCte ){
|
if( pCte ){
|
||||||
struct Cte *p;
|
struct Cte *p;
|
||||||
@@ -3533,7 +3541,6 @@ static int ctePush(Parse *pParse, struct Cte *pCte){
|
|||||||
}
|
}
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ctePop(Parse *pParse, struct Cte *pCte){
|
static void ctePop(Parse *pParse, struct Cte *pCte){
|
||||||
if( pCte ){
|
if( pCte ){
|
||||||
assert( pParse->pCte==pCte );
|
assert( pParse->pCte==pCte );
|
||||||
|
|||||||
@@ -2640,18 +2640,18 @@ int sqlite3WalkSelectFrom(Walker*, Select*);
|
|||||||
#define WRC_Abort 2 /* Abandon the tree walk */
|
#define WRC_Abort 2 /* Abandon the tree walk */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** An instance of this structure represents a set of CTEs (common table
|
** An instance of this structure represents a set of on or more CTEs
|
||||||
** expressions) created by a single WITH clause.
|
** (common table expressions) created by a single WITH clause.
|
||||||
*/
|
*/
|
||||||
struct With {
|
struct With {
|
||||||
int nCte; /* Number of CTEs */
|
int nCte; /* Number of CTEs in the WITH clause */
|
||||||
With *pOuter; /* Containing WITH clause, or NULL */
|
With *pOuter; /* Containing WITH clause, or NULL */
|
||||||
struct Cte {
|
struct Cte { /* For each CTE in the WITH clause.... */
|
||||||
char *zName; /* Name of this CTE */
|
char *zName; /* Name of this CTE */
|
||||||
ExprList *pCols; /* List of explicit column names, or NULL */
|
ExprList *pCols; /* List of explicit column names, or NULL */
|
||||||
Select *pSelect; /* The contents of the CTE */
|
Select *pSelect; /* The definition of this CTE */
|
||||||
struct Cte *pOuterCte;
|
struct Cte *pOuterCte; /* Next WITH clause in outer context */
|
||||||
Table *pTab;
|
Table *pTab; /* Table object for this CTE */
|
||||||
} a[1];
|
} a[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user