Index: src/parse.y ================================================================== --- src/parse.y +++ src/parse.y @@ -12,11 +12,11 @@ ** This file contains SQLite's grammar for SQL. Process this file ** using the lemon parser generator to generate C code that runs ** the parser. Lemon will also generate a header file containing ** numeric codes for all of the tokens. ** -** @(#) $Id: parse.y,v 1.134 2004/08/20 16:02:39 drh Exp $ +** @(#) $Id: parse.y,v 1.135 2004/08/25 04:07:02 drh Exp $ */ %token_prefix TK_ %token_type {Token} %default_type {Token} %extra_argument {Parse *pParse} @@ -559,16 +559,11 @@ expr(A) ::= BLOB(X). {A = sqlite3Expr(@X, 0, 0, &X);} expr(A) ::= VARIABLE(X). { Token *pToken = &X; Expr *pExpr = A = sqlite3Expr(TK_VARIABLE, 0, 0, pToken); if( pExpr ){ - if( pToken->z[0]==':' ){ - int n = pExpr->iTable = atoi(&pToken->z[1]); - if( pParse->nVarnVar = n; - }else{ - pExpr->iTable = ++pParse->nVar; - } + pExpr->iTable = ++pParse->nVar; } } expr(A) ::= ID(X) LP exprlist(Y) RP(E). { A = sqlite3ExprFunction(Y, &X); sqlite3ExprSpan(A,&X,&E); Index: src/tclsqlite.c ================================================================== --- src/tclsqlite.c +++ src/tclsqlite.c @@ -9,11 +9,11 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* ** A TCL Interface to SQLite ** -** $Id: tclsqlite.c,v 1.101 2004/08/24 15:23:34 drh Exp $ +** $Id: tclsqlite.c,v 1.102 2004/08/25 04:07:02 drh Exp $ */ #ifndef NO_TCL /* Omit this whole file if TCL is unavailable */ #include "sqliteInt.h" #include "hash.h" @@ -743,11 +743,11 @@ /* Bind values to wildcards that begin with $ */ nVar = sqlite3_bind_parameter_count(pStmt); for(i=1; i<=nVar; i++){ const char *zVar = sqlite3_bind_parameter_name(pStmt, i); - if( zVar[0]=='$' ){ + if( zVar[0]=='$' || zVar[0]==':' ){ Tcl_Obj *pVar = Tcl_GetVar2Ex(interp, &zVar[1], 0, 0); if( pVar ){ int n; u8 *data; char *zType = pVar->typePtr ? pVar->typePtr->name : ""; Index: src/tokenize.c ================================================================== --- src/tokenize.c +++ src/tokenize.c @@ -13,11 +13,11 @@ ** ** This file contains C code that splits an SQL input string up into ** individual tokens and sends those tokens one-by-one over to the ** parser for analysis. ** -** $Id: tokenize.c,v 1.83 2004/08/24 15:23:34 drh Exp $ +** $Id: tokenize.c,v 1.84 2004/08/25 04:07:02 drh Exp $ */ #include "sqliteInt.h" #include "os.h" #include #include @@ -372,18 +372,13 @@ case '?': { *tokenType = TK_VARIABLE; return 1; } case ':': { - for(i=1; isdigit(z[i]); i++){} - if( i>1 && z[i]==':' ){ - *tokenType = TK_VARIABLE; - return i+1; - }else{ - *tokenType = TK_ILLEGAL; - return i; - } + for(i=1; (z[i]&0x80)!=0 || isIdChar[z[i]]; i++){} + *tokenType = i>1 ? TK_VARIABLE : TK_ILLEGAL; + return i; } case '$': { int c; *tokenType = TK_VARIABLE; if( z[1]=='{' ){ Index: test/bind.test ================================================================== --- test/bind.test +++ test/bind.test @@ -9,11 +9,11 @@ # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script testing the sqlite_bind API. # -# $Id: bind.test,v 1.17 2004/08/20 18:34:20 drh Exp $ +# $Id: bind.test,v 1.18 2004/08/25 04:07:03 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -35,26 +35,26 @@ } do_test bind-1.1 { db close set DB [sqlite3 db test.db] - execsql {CREATE TABLE t1(a,b,c)} - set VM [sqlite3_prepare $DB {INSERT INTO t1 VALUES(:1:,?,:3:)} -1 TAIL] + execsql {CREATE TABLE t1(a,b,c);} + set VM [sqlite3_prepare $DB {INSERT INTO t1 VALUES(:1,?,:abc)} -1 TAIL] set TAIL } {} do_test bind-1.1.1 { sqlite3_bind_parameter_count $VM } 3 do_test bind-1.1.2 { sqlite3_bind_parameter_name $VM 1 -} {:1:} +} {:1} do_test bind-1.1.3 { sqlite3_bind_parameter_name $VM 2 } {} do_test bind-1.1.4 { sqlite3_bind_parameter_name $VM 3 -} {:3:} +} {:abc} do_test bind-1.2 { sqlite_step $VM N VALUES COLNAMES } {SQLITE_DONE} do_test bind-1.3 { execsql {SELECT rowid, * FROM t1} Index: www/capi3ref.tcl ================================================================== --- www/capi3ref.tcl +++ www/capi3ref.tcl @@ -1,6 +1,6 @@ -set rcsid {$Id: capi3ref.tcl,v 1.8 2004/08/20 16:02:40 drh Exp $} +set rcsid {$Id: capi3ref.tcl,v 1.9 2004/08/25 04:07:03 drh Exp $} source common.tcl header {C/C++ Interface For SQLite Version 3} puts {

C/C++ Interface For SQLite Version 3

} @@ -78,18 +78,18 @@ int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int n, void(*)(void*)); #define SQLITE_STATIC ((void(*)(void *))0) #define SQLITE_TRANSIENT ((void(*)(void *))-1) } { In the SQL strings input to sqlite3_prepare() and sqlite3_prepare16(), - one or more literals can be replace by a wildcard "?" or ":N:" where - N is an integer. The value of these wildcard literals can be set - using these routines. + one or more literals can be replace by a wildcard "?" or ":AAA" where + AAA is an alphanumeric identifier. + The value of these wildcard literals (also called "host parameter names") + can be set using these routines. The first parameter is a pointer to the sqlite3_stmt structure returned from sqlite3_prepare(). The second parameter is the - index of the wildcard. The first "?" has an index of 1. ":N:" wildcards - use the index N. + index of the wildcard. The first wildcard has an index of 1. The fifth parameter to sqlite3_bind_blob(), sqlite3_bind_text(), and sqlite3_bind_text16() is a destructor used to dispose of the BLOB or text after SQLite has finished with it. If the fifth argument is the special value SQLITE_STATIC, then the library assumes that the information @@ -112,11 +112,11 @@ api {} { const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int n); } { Return the name of the n-th wildcard in the precompiled statement. - Wildcards of the form ":N:" have a name which is the string ":N:". + Wildcards of the form ":AAA" have a name which is the string ":AAA". Wildcards of the form "?" have no name. If the value n is out of range or if the n-th wildcard is nameless, then NULL is returned. The returned string is always in the UTF-8 encoding.