diff options
author | drh <drh@noemail.net> | 2013-01-03 18:07:37 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2013-01-03 18:07:37 +0000 |
commit | 953bf725b418bf8b3d6ca8554bfe7773da061138 (patch) | |
tree | c1f42fd28abb66dce6f8bbc91762c078367756ac /src/sqliteInt.h | |
parent | b376daeb6758159e5b9835d729f0b22011e8e68a (diff) | |
parent | 38b384a0328c2dcbdc2d46732e08b68d6cec632f (diff) | |
download | sqlite-953bf725b418bf8b3d6ca8554bfe7773da061138.tar.gz sqlite-953bf725b418bf8b3d6ca8554bfe7773da061138.zip |
Improvements to column name resolution in queries with parenthesized FROM
clauses. Also includes a fix for ticket [beba9cae6345a3].
FossilOrigin-Name: 99127a669c49f82918853091c9c5b7db5ad73cba
Diffstat (limited to 'src/sqliteInt.h')
-rw-r--r-- | src/sqliteInt.h | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 7922bf0d4..74fa0b31c 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -1771,18 +1771,27 @@ struct Expr { ** list of "ID = expr" items in an UPDATE. A list of expressions can ** also be used as the argument to a function, in which case the a.zName ** field is not used. +** +** By default the Expr.zSpan field holds a human-readable description of +** the expression that is used in the generation of error messages and +** column labels. In this case, Expr.zSpan is typically the text of a +** column expression as it exists in a SELECT statement. However, if +** the bSpanIsTab flag is set, then zSpan is overloaded to mean the name +** of the result column in the form: DATABASE.TABLE.COLUMN. This later +** form is used for name resolution with nested FROM clauses. */ struct ExprList { int nExpr; /* Number of expressions on the list */ int iECursor; /* VDBE Cursor associated with this ExprList */ struct ExprList_item { /* For each expression in the list */ - Expr *pExpr; /* The list of expressions */ - char *zName; /* Token associated with this expression */ - char *zSpan; /* Original text of the expression */ - u8 sortOrder; /* 1 for DESC or 0 for ASC */ - u8 done; /* A flag to indicate when processing is finished */ - u16 iOrderByCol; /* For ORDER BY, column number in result set */ - u16 iAlias; /* Index into Parse.aAlias[] for zName */ + Expr *pExpr; /* The list of expressions */ + char *zName; /* Token associated with this expression */ + char *zSpan; /* Original text of the expression */ + u8 sortOrder; /* 1 for DESC or 0 for ASC */ + unsigned done :1; /* A flag to indicate when processing is finished */ + unsigned bSpanIsTab :1; /* zSpan holds DB.TABLE.COLUMN */ + u16 iOrderByCol; /* For ORDER BY, column number in result set */ + u16 iAlias; /* Index into Parse.aAlias[] for zName */ } *a; /* Alloc a power of two greater or equal to nExpr */ }; @@ -3072,6 +3081,7 @@ void sqlite3NestedParse(Parse*, const char*, ...); void sqlite3ExpirePreparedStatements(sqlite3*); int sqlite3CodeSubselect(Parse *, Expr *, int, int); void sqlite3SelectPrep(Parse*, Select*, NameContext*); +int sqlite3MatchSpanName(const char*, const char*, const char*, const char*); int sqlite3ResolveExprNames(NameContext*, Expr*); void sqlite3ResolveSelectNames(Parse*, Select*, NameContext*); int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*); |