-C :-)\s(CVS\s24)
-D 2000-05-31T17:59:26
+C :-)\s(CVS\s25)
+D 2000-05-31T18:20:14
F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4
F Makefile.in 7ac2fef265940d93a544cb454efa836451559a71
F README 6b5960603c7f8bf42fc022b4b6436f242f238dbb
F src/expr.c 91970700e3e39b2b725b028c166f588a5bb0c038
F src/insert.c bd34716d0bba5561f6b55101adbf16fa75f872e8
F src/main.c 25cce7bce0eb3ba10bada7c05f4b38dc6dbbc86f
-F src/parse.y bdfcd0a3fe7d6ad4b41dc2cbc0d04c4302f609b0
-F src/select.c 540fae91639d93ea1ef348882197554896841a2f
+F src/parse.y 038e0f0fd243b89344c974c5d0552e85c4d27916
+F src/select.c 719ca9605a351b2a3521a692ae8d2936d4832609
F src/shell.c c5752d32cdeaa7d548d4f91177b697b023a00381
F src/sqlite.h 2397c17a8f4ca90c09acab0100dc7e2f8f441b69
F src/sqliteInt.h 81552acdedb0c3b256510a66c0f656d35d2ea2bd
F test/expr.test 1f514623a568ebd351d0f1fe30c8f273681c1396
F test/index.test 8d4f26901a5582daa353fe3c8266cbf4a53af830
F test/insert.test 161bc67a4189738c559e3569323ceae31f4d49d6
-F test/select1.test b994637d78e5b7f90c2032760f4c87aef8d461c1
+F test/select1.test a0b00df77e85adff75c338e487718c5d31f69e3a
F test/table.test 85d6f410d127ec508c6640f02d7c40d218414e81
F test/tester.tcl 44690d463c1dc83a4c76ccde07cc146a988600f6
F test/update.test 69459302ea75cafac1479e60b0e36efb88123c0e
F www/changes.tcl 995d64c96978a996f0e9e46f2ce896355a7c87a7
F www/index.tcl 600e85c207929bedb9c6fd221aa7875fd8f43edf
F www/sqlite.tcl 7deb564df188ad4523adecfe2365de6d09f6dfd9
-P 0b040cea57ee76103030c0d5ef571dc481a2b2d3
-R 6c10963e34e77cc84c8f0379f7394fc1
+P 4cd98ebaeaedf66b258bbfa3a04d90c054294322
+R 1eda0f1d67d8520e96913acfd2d34146
U drh
-Z 83085793cdd6972c96321a385eef56bb
+Z 21bfd749554e09c09048cdae5c21372a
-4cd98ebaeaedf66b258bbfa3a04d90c054294322
\ No newline at end of file
+35a8f523e8389a1a6e41f6561500644b165d556e
\ No newline at end of file
** 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}
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}
** 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"
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{
/* 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
# This file implements regression tests for SQLite library. The
# focus of this file is testing the SELECT statement.
#
-# $Id: select1.test,v 1.1 2000/05/31 17:59:27 drh Exp $
+# $Id: select1.test,v 1.2 2000/05/31 18:20:14 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ORDER BY f2}} msg]
lappend v $msg
} {0 {field1 33 test2.t1 abc field1 77 test2.t1 abc}}
+do_test select-6.7 {
+ set v [catch {execsql2 {SELECT A.f1, t1 FROM test1 as A, test2
+ ORDER BY f2}} msg]
+ lappend v $msg
+} {0 {A.f1 11 test2.t1 abc A.f1 33 test2.t1 abc}}
+do_test select-6.8 {
+ set v [catch {execsql2 {SELECT A.f1, f1 FROM test1 as A, test1 as B
+ ORDER BY f2}} msg]
+ lappend v $msg
+} {1 {ambiguous field name: f1}}
+do_test select-6.8 {
+ set v [catch {execsql2 {SELECT A.f1, B.f1 FROM test1 as A, test1 as B
+ ORDER BY f2}} msg]
+ lappend v $msg
+} {1 {ambiguous field name: f2}}
+do_test select-6.9 {
+ set v [catch {execsql2 {SELECT A.f1, B.f1 FROM test1 as A, test1 as B
+ ORDER BY A.f1, B.f1}} msg]
+ lappend v $msg
+} {0 {A.f1 11 B.f1 11 A.f1 11 B.f1 33 A.f1 33 B.f1 11 A.f1 33 B.f1 33}}
finish_test