aboutsummaryrefslogtreecommitdiff
path: root/src/resolve.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-12-13 01:12:21 +0000
committerdrh <drh@noemail.net>2019-12-13 01:12:21 +0000
commit85d9411c09154932619e77122b3677cd78a44664 (patch)
tree9e50afbb083e7d0048bc26ad443252999a8c9776 /src/resolve.c
parent1b47c9c98e9e00bc24d11e6c6cad2c754b05dd02 (diff)
parentc4938ea2ba17cdba4bd03a23b2f3cfd783f79c0a (diff)
downloadsqlite-85d9411c09154932619e77122b3677cd78a44664.tar.gz
sqlite-85d9411c09154932619e77122b3677cd78a44664.zip
Reduce the size of ExprList to 24-bytes per entry, down from 32-bytes per
entry. This helps keep lookaside allocations in the mini-size. FossilOrigin-Name: bda92d92bf69a73bc6dd498f92578ad6e81111a3f97bc8724d1720e7283a83b6
Diffstat (limited to 'src/resolve.c')
-rw-r--r--src/resolve.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/resolve.c b/src/resolve.c
index b3c331535..572e0a9f3 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( 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].zEName;
- if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){
+ char *zAs;
+ if( pEList->a[j].eEName==ENAME_NAME
+ && (zAs = pEList->a[j].zEName)!=0
+ && sqlite3StrICmp(zAs, zCol)==0
+ ){
Expr *pOrig;
assert( pExpr->pLeft==0 && pExpr->pRight==0 );
assert( pExpr->x.pList==0 );
@@ -1116,7 +1122,10 @@ static int resolveAsName(
char *zCol = pE->u.zToken;
for(i=0; i<pEList->nExpr; i++){
char *zAs = pEList->a[i].zEName;
- if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){
+ if( pEList->a[i].eEName==ENAME_NAME
+ && (zAs = pEList->a[i].zEName)!=0
+ && sqlite3StrICmp(zAs, zCol)==0
+ ){
return i+1;
}
}