1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

:-) (CVS 25)

FossilOrigin-Name: 35a8f523e8389a1a6e41f6561500644b165d556e
This commit is contained in:
drh
2000-05-31 18:20:14 +00:00
parent 3aadb2e64c
commit da9d6c4572
5 changed files with 42 additions and 23 deletions

View File

@ -26,7 +26,7 @@
** the parser. Lemon will also generate a header file containing
** numeric codes for all of the tokens.
**
** @(#) $Id: parse.y,v 1.4 2000/05/31 15:34:53 drh Exp $
** @(#) $Id: parse.y,v 1.5 2000/05/31 18:20:14 drh Exp $
*/
%token_prefix TK_
%token_type {Token}
@ -176,13 +176,7 @@ sortlist(A) ::= sortitem(Y) sortorder(Z).
A = sqliteExprListAppend(0,Y,0);
A->a[0].idx = Z;
}
sortitem(A) ::= ID(X). {A = sqliteExpr(TK_ID, 0, 0, &X);}
sortitem(A) ::= ID(X) DOT ID(Y).
{
Expr *temp1 = sqliteExpr(TK_ID, 0, 0, &X);
Expr *temp2 = sqliteExpr(TK_ID, 0, 0, &Y);
A = sqliteExpr(TK_DOT, temp1, temp2, 0);
}
sortitem(A) ::= expr(X). {A = X;}
%type sortorder {int}

View File

@ -24,7 +24,7 @@
** This file contains C code routines that are called by the parser
** to handle SELECT statements.
**
** $Id: select.c,v 1.1 2000/05/31 15:34:53 drh Exp $
** $Id: select.c,v 1.2 2000/05/31 18:20:14 drh Exp $
*/
#include "sqliteInt.h"
@ -154,8 +154,11 @@ void sqliteSelect(
if( pTabList->nId>1 ){
char *zName = 0;
Table *pTab = pTabList->a[p->iTable].pTab;
sqliteSetString(&zName, pTab->zName, ".",
pTab->azCol[p->iField], 0);
char *zTab;
zTab = pTabList->a[p->iTable].zAlias;
if( zTab==0 ) zTab = pTab->zName;
sqliteSetString(&zName, zTab, ".", pTab->azCol[p->iField], 0);
sqliteVdbeAddOp(v, OP_ColumnName, i, 0, zName, 0);
sqliteFree(zName);
}else{
@ -191,8 +194,10 @@ void sqliteSelect(
/* Pull the requested fields.
*/
for(i=0; i<pEList->nExpr; i++){
sqliteExprCode(pParse, pEList->a[i].pExpr);
if( !isAgg ){
for(i=0; i<pEList->nExpr; i++){
sqliteExprCode(pParse, pEList->a[i].pExpr);
}
}
/* If there is no ORDER BY clause, then we can invoke the callback