aboutsummaryrefslogtreecommitdiff
path: root/src/resolve.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2017-03-07 03:25:52 +0000
committerdrh <drh@noemail.net>2017-03-07 03:25:52 +0000
commit3cf48e3e89ff34d61436751d5a47f15eba570b8a (patch)
treedd6e29553fe7c47d84d879d9f3a5b265d2841de4 /src/resolve.c
parent59dbe3a5efcd5ea47ef6038a861dc4d76838a43f (diff)
downloadsqlite-3cf48e3e89ff34d61436751d5a47f15eba570b8a.tar.gz
sqlite-3cf48e3e89ff34d61436751d5a47f15eba570b8a.zip
Small size reduction and performance increase in the name resolver routine
for expressions. FossilOrigin-Name: 1a3554e1d71b666325ff377fae5329d79ce5c05f
Diffstat (limited to 'src/resolve.c')
-rw-r--r--src/resolve.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/src/resolve.c b/src/resolve.c
index 7d89b6fec..59157996c 100644
--- a/src/resolve.c
+++ b/src/resolve.c
@@ -608,33 +608,38 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
#endif /* defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT)
&& !defined(SQLITE_OMIT_SUBQUERY) */
- /* A lone identifier is the name of a column.
- */
- case TK_ID: {
- return lookupName(pParse, 0, 0, pExpr->u.zToken, pNC, pExpr);
- }
-
- /* A table name and column name: ID.ID
+ /* A column name: ID
+ ** Or table name and column name: ID.ID
** Or a database, table and column: ID.ID.ID
+ **
+ ** The TK_ID and TK_OUT cases are combined so that there will only
+ ** be one call to lookupName(). Then the compiler will in-line
+ ** lookupName() for a size reduction and performance increase.
*/
+ case TK_ID:
case TK_DOT: {
const char *zColumn;
const char *zTable;
const char *zDb;
Expr *pRight;
- /* if( pSrcList==0 ) break; */
- notValid(pParse, pNC, "the \".\" operator", NC_IdxExpr);
- pRight = pExpr->pRight;
- if( pRight->op==TK_ID ){
+ if( pExpr->op==TK_ID ){
zDb = 0;
- zTable = pExpr->pLeft->u.zToken;
- zColumn = pRight->u.zToken;
+ zTable = 0;
+ zColumn = pExpr->u.zToken;
}else{
- assert( pRight->op==TK_DOT );
- zDb = pExpr->pLeft->u.zToken;
- zTable = pRight->pLeft->u.zToken;
- zColumn = pRight->pRight->u.zToken;
+ notValid(pParse, pNC, "the \".\" operator", NC_IdxExpr);
+ pRight = pExpr->pRight;
+ if( pRight->op==TK_ID ){
+ zDb = 0;
+ zTable = pExpr->pLeft->u.zToken;
+ zColumn = pRight->u.zToken;
+ }else{
+ assert( pRight->op==TK_DOT );
+ zDb = pExpr->pLeft->u.zToken;
+ zTable = pRight->pLeft->u.zToken;
+ zColumn = pRight->pRight->u.zToken;
+ }
}
return lookupName(pParse, zDb, zTable, zColumn, pNC, pExpr);
}