-C Clean\sup\ssome\scompiler\swarnings.\s(CVS\s575)
-D 2002-05-21T13:18:26
+C Double-quoted\sstrings\sresolve\sto\scolumn\snames\sif\spossible.\s\sSingle-quoted\nstrings\scontinue\sto\sbe\sinterpreted\sas\sstring\sliterals.\s(CVS\s576)
+D 2002-05-21T13:43:04
F Makefile.in 6291a33b87d2a395aafd7646ee1ed562c6f2c28c
F Makefile.template 4e11752e0b5c7a043ca50af4296ec562857ba495
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
F src/build.c f5aa02e4553ca2db941d6e7f025a180ddc4cea49
F src/delete.c c2eae01b76d5418d4ff1768659dfb199c38f0641
F src/encode.c 346b12b46148506c32038524b95c4631ab46d760
-F src/expr.c 2c7535ba013b731ed73f12b6cc1cd5b466efb3e2
+F src/expr.c 01e1e395392284a3a480c90bd60b3a0fa99aab38
F src/func.c a31dcba85bc2ecb9b752980289cf7e6cd0cafbce
F src/hash.c cc259475e358baaf299b00a2c7370f2b03dda892
F src/hash.h dca065dda89d4575f3176e75e9a3dc0f4b4fb8b9
F test/pragma.test 0b9675ef1f5ba5b43abfa337744445fc5b01a34a
F test/printf.test 3cb415073754cb8ff076f26173143c3cd293a9da
F test/quick.test 6f023c7a73fc413e6d65b7a1879c79764038dc05
-F test/quote.test 286db944717afa9a9bf829dd85e59185c65d5435
+F test/quote.test 08f23385c685d3dc7914ec760d492cacea7f6e3d
F test/rowid.test 4c55943300cddf73dd0f88d40a268cab14c83274
F test/select1.test c19617be69fb1322c71e100b5882c469729c4bf1
F test/select2.test aceea74fd895b9d007512f72499db589735bd8e4
F www/sqlite.tcl 8b5884354cb615049aed83039f8dfe1552a44279
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P f795afd63f19ab61c2b3b96621cb6dda31ce0379
-R f30d941f16e46cee9269d14d467bbb83
+P 3399b01219b9e75b93587b5634d199d9e6fb6e42
+R 11e5246ab7bc31d3891976630a69eee3
U drh
-Z deb3155eb826aa47da17dfd5a82d0d75
+Z 5b4da1c5d40f9084cbbd43db1688a090
-3399b01219b9e75b93587b5634d199d9e6fb6e42
\ No newline at end of file
+55e7d65496624c8e48673d8747f3123786bfedbc
\ No newline at end of file
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
-** $Id: expr.c,v 1.60 2002/05/19 23:43:14 danielk1977 Exp $
+** $Id: expr.c,v 1.61 2002/05/21 13:43:04 drh Exp $
*/
#include "sqliteInt.h"
/*
** Walk an expression tree. Return 1 if the expression is constant
** and 0 if it involves variables.
+**
+** For the purposes of this function, a double-quoted string (ex: "abc")
+** is considered a variable but a single-quoted string (ex: 'abc') is
+** a constant.
*/
int sqliteExprIsConstant(Expr *p){
switch( p->op ){
case TK_COLUMN:
case TK_DOT:
return 0;
+ case TK_STRING:
+ return p->token.z[0]=='\'';
case TK_INTEGER:
case TK_FLOAT:
- case TK_STRING:
return 1;
default: {
if( p->pLeft && !sqliteExprIsConstant(p->pLeft) ) return 0;
if( pExpr==0 || pTabList==0 ) return 0;
assert( base+pTabList->nId<=pParse->nTab );
switch( pExpr->op ){
+ /* Double-quoted strings (ex: "abc") are used as identifiers if
+ ** possible. Otherwise they remain as strings. Single-quoted
+ ** strings (ex: 'abc') are always string literals.
+ */
+ case TK_STRING: {
+ if( pExpr->token.z[0]=='\'' ) break;
+ /* Fall thru into the TK_ID case if this is a double-quoted string */
+ }
/* A lone identifier. Try and match it as follows:
**
** 1. To the name of a column of one of the tables in pTabList
pExpr->op = TK_COLUMN;
}
sqliteFree(z);
- if( cnt==0 ){
+ if( cnt==0 && pExpr->token.z[0]!='"' ){
sqliteSetNString(&pParse->zErrMsg, "no such column: ", -1,
pExpr->token.z, pExpr->token.n, 0);
pParse->nErr++;
# focus of this file is the ability to specify table and column names
# as quoted strings.
#
-# $Id: quote.test,v 1.2 2001/09/16 00:13:28 drh Exp $
+# $Id: quote.test,v 1.3 2002/05/21 13:43:04 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
} msg ]
lappend r $msg
} {0 {hello 10}}
+do_test quote-1.3.1 {
+ catchsql {
+ SELECT '!pqr', '#xyz'+5 FROM '@abc'
+ }
+} {0 {!pqr 5}}
+do_test quote-1.3.2 {
+ catchsql {
+ SELECT "!pqr", "#xyz"+5 FROM '@abc'
+ }
+} {0 {hello 10}}
+do_test quote-1.3 {
+ set r [catch {
+ execsql {SELECT '@abc'.'!pqr', '@abc'.'#xyz'+5 FROM '@abc'}
+ } msg ]
+ lappend r $msg
+} {0 {hello 10}}
do_test quote-1.4 {
set r [catch {
execsql {UPDATE '@abc' SET '#xyz'=11}