aboutsummaryrefslogtreecommitdiff
path: root/src/resolve.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2020-01-02 22:28:47 +0000
committerdrh <drh@noemail.net>2020-01-02 22:28:47 +0000
commit24d35e409c900adba4f5528e70c6c7e5e748cfd0 (patch)
treeebf7659473500f6e926d5db02e84f45081ac7fb7 /src/resolve.c
parent0c4f82051c7ff301ea78cf1d279005d2dc26ad19 (diff)
parent9fc1b9af36e54c7863a9404a9611abfb4b682374 (diff)
downloadsqlite-24d35e409c900adba4f5528e70c6c7e5e748cfd0.tar.gz
sqlite-24d35e409c900adba4f5528e70c6c7e5e748cfd0.zip
Add the two-size lookaside memory allocator. Also, reduce the per-entry
size of the ExprList object. FossilOrigin-Name: 51665bf0f975fb248964a4be205a4f3285d3f3f8cc697977d264efefbbe20dd8
Diffstat (limited to 'src/resolve.c')
-rw-r--r--src/resolve.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/resolve.c b/src/resolve.c
index ec082ba25..f69f9ef31 100644
--- a/src/resolve.c
+++ b/src/resolve.c
@@ -132,13 +132,16 @@ static int nameInUsingClause(IdList *pUsing, const char *zCol){
** and zCol. If any of zDb, zTab, and zCol are NULL then those fields will
** match anything.
*/
-int sqlite3MatchSpanName(
- const char *zSpan,
+int sqlite3MatchEName(
+ const struct ExprList_item *pItem,
const char *zCol,
const char *zTab,
const char *zDb
){
int n;
+ const char *zSpan;
+ if( NEVER(pItem->eEName!=ENAME_TAB) ) return 0;
+ zSpan = pItem->zEName;
for(n=0; ALWAYS(zSpan[n]) && zSpan[n]!='.'; n++){}
if( zDb && (sqlite3StrNICmp(zSpan, zDb, n)!=0 || zDb[n]!=0) ){
return 0;
@@ -267,7 +270,7 @@ static int lookupName(
int hit = 0;
pEList = pItem->pSelect->pEList;
for(j=0; j<pEList->nExpr; j++){
- if( sqlite3MatchSpanName(pEList->a[j].zSpan, zCol, zTab, zDb) ){
+ if( sqlite3MatchEName(&pEList->a[j], zCol, zTab, zDb) ){
cnt++;
cntTab = 2;
pMatch = pItem;
@@ -448,8 +451,11 @@ static int lookupName(
pEList = pNC->uNC.pEList;
assert( pEList!=0 );
for(j=0; j<pEList->nExpr; j++){
- char *zAs = pEList->a[j].zName;
- if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){
+ char *zAs = pEList->a[j].zEName;
+ if( pEList->a[j].eEName==ENAME_NAME
+ && ALWAYS(zAs!=0)
+ && sqlite3StrICmp(zAs, zCol)==0
+ ){
Expr *pOrig;
assert( pExpr->pLeft==0 && pExpr->pRight==0 );
assert( pExpr->x.pList==0 );
@@ -1117,8 +1123,11 @@ static int resolveAsName(
if( pE->op==TK_ID ){
char *zCol = pE->u.zToken;
for(i=0; i<pEList->nExpr; i++){
- char *zAs = pEList->a[i].zName;
- if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){
+ char *zAs = pEList->a[i].zEName;
+ if( pEList->a[i].eEName==ENAME_NAME
+ && ALWAYS(zAs!=0)
+ && sqlite3StrICmp(zAs, zCol)==0
+ ){
return i+1;
}
}