/ Check-in [f30abdf9]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Clarification and typo fixes in comments related to name resolution. No changes to code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f30abdf9d814d6c75bf1c803054737c737ad636f
User & Date: drh 2013-08-15 14:27:42
Context
2013-08-15
20:05
Make it easy to attach a debugger the test fixture process prior to any tests being run. check-in: 53cd9ebf user: mistachkin tags: trunk
14:27
Clarification and typo fixes in comments related to name resolution. No changes to code. check-in: f30abdf9 user: drh tags: trunk
2013-08-14
00:20
Fix a few more minor comment typos. No changes to code. check-in: 9e999081 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/resolve.c.

  1005   1005   ** The Name context of the SELECT statement is pNC.  zType is either
  1006   1006   ** "ORDER" or "GROUP" depending on which type of clause pOrderBy is.
  1007   1007   **
  1008   1008   ** This routine resolves each term of the clause into an expression.
  1009   1009   ** If the order-by term is an integer I between 1 and N (where N is the
  1010   1010   ** number of columns in the result set of the SELECT) then the expression
  1011   1011   ** in the resolution is a copy of the I-th result-set expression.  If
  1012         -** the order-by term is an identify that corresponds to the AS-name of
         1012  +** the order-by term is an identifier that corresponds to the AS-name of
  1013   1013   ** a result-set expression, then the term resolves to a copy of the
  1014   1014   ** result-set expression.  Otherwise, the expression is resolved in
  1015   1015   ** the usual way - using sqlite3ResolveExprNames().
  1016   1016   **
  1017   1017   ** This routine returns the number of errors.  If errors occur, then
  1018   1018   ** an appropriate error message might be left in pParse.  (OOM errors
  1019   1019   ** excepted.)
................................................................................
  1183   1183       /* If a HAVING clause is present, then there must be a GROUP BY clause.
  1184   1184       */
  1185   1185       if( p->pHaving && !pGroupBy ){
  1186   1186         sqlite3ErrorMsg(pParse, "a GROUP BY clause is required before HAVING");
  1187   1187         return WRC_Abort;
  1188   1188       }
  1189   1189     
  1190         -    /* Add the expression list to the name-context before parsing the
         1190  +    /* Add the output column list to the name-context before parsing the
  1191   1191       ** other expressions in the SELECT statement. This is so that
  1192   1192       ** expressions in the WHERE clause (etc.) can refer to expressions by
  1193   1193       ** aliases in the result set.
  1194   1194       **
  1195   1195       ** Minor point: If this is the case, then the expression will be
  1196   1196       ** re-evaluated for each reference to it.
  1197   1197       */

Changes to src/sqliteInt.h.

  2002   2002   ** NameContext in the parent query.  Thus the process of scanning the
  2003   2003   ** NameContext list corresponds to searching through successively outer
  2004   2004   ** subqueries looking for a match.
  2005   2005   */
  2006   2006   struct NameContext {
  2007   2007     Parse *pParse;       /* The parser */
  2008   2008     SrcList *pSrcList;   /* One or more tables used to resolve names */
  2009         -  ExprList *pEList;    /* Optional list of named expressions */
         2009  +  ExprList *pEList;    /* Optional list of result-set columns */
  2010   2010     AggInfo *pAggInfo;   /* Information about aggregates at this level */
  2011   2011     NameContext *pNext;  /* Next outer name context.  NULL for outermost */
  2012   2012     int nRef;            /* Number of names resolved by this context */
  2013   2013     int nErr;            /* Number of errors encountered while resolving names */
  2014   2014     u8 ncFlags;          /* Zero or more NC_* flags defined below */
  2015   2015   };
  2016   2016