mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Handle quotes on the table name in TABLE.* terms in SELECT statements.
Ticket #680. (CVS 1833) FossilOrigin-Name: 826b6797a9f08c69b9378cb403d746e91a54dcde
This commit is contained in:
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Report\san\serror\swhen\sattempting\sto\sopen\sa\sdirectory\sas\sa\sdatabase.\nTicket\s#687.\s(CVS\s1832)
|
||||
D 2004-07-20T01:14:14
|
||||
C Handle\squotes\son\sthe\stable\sname\sin\sTABLE.*\sterms\sin\sSELECT\sstatements.\nTicket\s#680.\s(CVS\s1833)
|
||||
D 2004-07-20T01:45:20
|
||||
F Makefile.in 4a5e570a9e2d35b09c31b3cf01b78cea764ade4b
|
||||
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
|
||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||
@ -57,7 +57,7 @@ F src/parse.y 51c8e696276c409618e66a4ccf316fcff245506e
|
||||
F src/pragma.c 8326df8c400f573eb43004dfb8e53e5102acb3e4
|
||||
F src/printf.c 36090f6d7b4946539de97c1850675ce55ef66c16
|
||||
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
|
||||
F src/select.c 540ac0efcb306651dd6e36fecdb8ca71dbd553b9
|
||||
F src/select.c aefda626660086addca4ce85c34aeef5d0f44c25
|
||||
F src/shell.c ebec5da57ea401f4886eefc790917b939d94d595
|
||||
F src/sqlite.h.in aaf46c8d458efd8aca694ec4f18c6ecf616ee55e
|
||||
F src/sqliteInt.h aeae6793d1db335ec1179ad9f26b0affc0ec658a
|
||||
@ -153,7 +153,7 @@ F test/quick.test 62cd0e248b3128c3e900d11d99c550aaec41db5f
|
||||
F test/quote.test 08f23385c685d3dc7914ec760d492cacea7f6e3d
|
||||
F test/rollback.test 4097328d44510277244ef4fa51b22b2f11d7ef4c
|
||||
F test/rowid.test b3d059f5c8d8874fa1c31030e0636f67405d20ea
|
||||
F test/select1.test 84b0d95f8bd0f5aaf695c08fdae7afc04b569436
|
||||
F test/select1.test 3ada65f9909987d763537db47c7ba49615f37e9f
|
||||
F test/select2.test 91a2225926039b0d1687840735c284dbbf89f0bc
|
||||
F test/select3.test ab2e583154ee230fa4b46b06512775a38cd9d8b0
|
||||
F test/select4.test 86e72fc3b07de4fe11439aa419e37db3c49467e2
|
||||
@ -237,7 +237,7 @@ F www/tclsqlite.tcl 19191cf2a1010eaeff74c51d83fd5f5a4d899075
|
||||
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
|
||||
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
|
||||
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
||||
P 7e72c5b7b5e355e41c30d4ef47268e11f4c97425
|
||||
R b4c6362b87074d879cc3fd681a28fcb4
|
||||
P 4d77037be34b357d24d18d1e13b5f0df580b83ff
|
||||
R 05526bc7d5efd58f2fcd959a0a53ce11
|
||||
U drh
|
||||
Z 9721ff4beae05addd24530ad93eb95e5
|
||||
Z 539496cd59c5e82424ba168888729c0a
|
||||
|
@ -1 +1 @@
|
||||
4d77037be34b357d24d18d1e13b5f0df580b83ff
|
||||
826b6797a9f08c69b9378cb403d746e91a54dcde
|
18
src/select.c
18
src/select.c
@ -12,7 +12,7 @@
|
||||
** This file contains C code routines that are called by the parser
|
||||
** to handle SELECT statements in SQLite.
|
||||
**
|
||||
** $Id: select.c,v 1.200 2004/07/20 00:20:23 drh Exp $
|
||||
** $Id: select.c,v 1.201 2004/07/20 01:45:20 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@ -988,11 +988,11 @@ static int fillInColumnList(Parse *pParse, Select *p){
|
||||
/* This expression is a "*" or a "TABLE.*" and needs to be
|
||||
** expanded. */
|
||||
int tableSeen = 0; /* Set to 1 when TABLE matches */
|
||||
Token *pName; /* text of name of TABLE */
|
||||
char *zTName; /* text of name of TABLE */
|
||||
if( pE->op==TK_DOT && pE->pLeft ){
|
||||
pName = &pE->pLeft->token;
|
||||
zTName = sqlite3NameFromToken(&pE->pLeft->token);
|
||||
}else{
|
||||
pName = 0;
|
||||
zTName = 0;
|
||||
}
|
||||
for(i=0; i<pTabList->nSrc; i++){
|
||||
Table *pTab = pTabList->a[i].pTab;
|
||||
@ -1000,9 +1000,8 @@ static int fillInColumnList(Parse *pParse, Select *p){
|
||||
if( zTabName==0 || zTabName[0]==0 ){
|
||||
zTabName = pTab->zName;
|
||||
}
|
||||
if( pName && (zTabName==0 || zTabName[0]==0 ||
|
||||
sqlite3StrNICmp(pName->z, zTabName, pName->n)!=0 ||
|
||||
zTabName[pName->n]!=0) ){
|
||||
if( zTName && (zTabName==0 || zTabName[0]==0 ||
|
||||
sqlite3StrICmp(zTName, zTabName)!=0) ){
|
||||
continue;
|
||||
}
|
||||
tableSeen = 1;
|
||||
@ -1047,13 +1046,14 @@ static int fillInColumnList(Parse *pParse, Select *p){
|
||||
}
|
||||
}
|
||||
if( !tableSeen ){
|
||||
if( pName ){
|
||||
sqlite3ErrorMsg(pParse, "no such table: %T", pName);
|
||||
if( zTName ){
|
||||
sqlite3ErrorMsg(pParse, "no such table: %s", zTName);
|
||||
}else{
|
||||
sqlite3ErrorMsg(pParse, "no tables specified");
|
||||
}
|
||||
rc = 1;
|
||||
}
|
||||
sqliteFree(zTName);
|
||||
}
|
||||
}
|
||||
sqlite3ExprListDelete(pEList);
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the SELECT statement.
|
||||
#
|
||||
# $Id: select1.test,v 1.34 2004/07/18 20:52:32 drh Exp $
|
||||
# $Id: select1.test,v 1.35 2004/07/20 01:45:21 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -621,11 +621,16 @@ do_test select1-11.3 {
|
||||
SELECT * FROM t3 AS x, t4 AS y;
|
||||
}
|
||||
} {x.a 1 x.b 2 y.a 3 y.b 4}
|
||||
do_test select1-11.4 {
|
||||
do_test select1-11.4.1 {
|
||||
execsql {
|
||||
SELECT t3.*, t4.b FROM t3, t4;
|
||||
}
|
||||
} {1 2 4}
|
||||
do_test select1-11.4.2 {
|
||||
execsql {
|
||||
SELECT "t3".*, t4.b FROM t3, t4;
|
||||
}
|
||||
} {1 2 4}
|
||||
do_test select1-11.5 {
|
||||
execsql2 {
|
||||
SELECT t3.*, t4.b FROM t3, t4;
|
||||
|
Reference in New Issue
Block a user