1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-09-11 08:30:57 +03:00

Additional updates to the symbol resolver and expression tree walker to

facilitate test coverage. (CVS 6764)

FossilOrigin-Name: a49c2d4befcc33dd98543fe7b4d4f0bae56f1a90
This commit is contained in:
drh
2009-06-15 23:15:59 +00:00
parent 0b3bf92417
commit f7828b5cd6
4 changed files with 20 additions and 22 deletions

View File

@@ -14,7 +14,7 @@
** resolve all identifiers by associating them with a particular
** table and column.
**
** $Id: resolve.c,v 1.29 2009/06/15 18:32:36 drh Exp $
** $Id: resolve.c,v 1.30 2009/06/15 23:15:59 drh Exp $
*/
#include "sqliteInt.h"
#include <stdlib.h>
@@ -119,7 +119,7 @@ static void resolveAlias(
** can be used.
**
** If the name cannot be resolved unambiguously, leave an error message
** in pParse and return non-zero. Return zero on success.
** in pParse and return WRC_Abort. Return WRC_Prune on success.
*/
static int lookupName(
Parse *pParse, /* The parsing context */
@@ -295,7 +295,7 @@ static int lookupName(
pOrig = pEList->a[j].pExpr;
if( !pNC->allowAgg && ExprHasProperty(pOrig, EP_Agg) ){
sqlite3ErrorMsg(pParse, "misuse of aliased aggregate %s", zAs);
return 2;
return WRC_Abort;
}
resolveAlias(pParse, pEList, j, pExpr, "");
cnt = 1;
@@ -327,7 +327,7 @@ static int lookupName(
if( cnt==0 && zTab==0 && ExprHasProperty(pExpr,EP_DblQuoted) ){
pExpr->op = TK_STRING;
pExpr->pTab = 0;
return 0;
return WRC_Prune;
}
/*
@@ -382,9 +382,9 @@ lookupname_end:
if( pTopNC==pNC ) break;
pTopNC = pTopNC->pNext;
}
return 0;
return WRC_Prune;
} else {
return 1;
return WRC_Abort;
}
}
@@ -443,8 +443,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
/* A lone identifier is the name of a column.
*/
case TK_ID: {
lookupName(pParse, 0, 0, pExpr->u.zToken, pNC, pExpr);
return WRC_Prune;
return lookupName(pParse, 0, 0, pExpr->u.zToken, pNC, pExpr);
}
/* A table name and column name: ID.ID
@@ -468,8 +467,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
zTable = pRight->pLeft->u.zToken;
zColumn = pRight->pRight->u.zToken;
}
lookupName(pParse, zDb, zTable, zColumn, pNC, pExpr);
return WRC_Prune;
return lookupName(pParse, zDb, zTable, zColumn, pNC, pExpr);
}
/* Resolve function names