1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Additional parsing bugs fixed. (CVS 3981)

FossilOrigin-Name: d12a8924c6083cdff14990b4fd036ca386c2e34a
This commit is contained in:
drh
2007-05-11 01:44:50 +00:00
parent db83f8231f
commit 4e05c83bc3
5 changed files with 30 additions and 32 deletions

View File

@@ -1,5 +1,5 @@
C Make\ssure\sthat\sthe\sREGISTER\stoken\sgenerates\sa\svalid\sExpr.\s\sREGISTER\swill\ncause\sthe\stokenizer\sto\sabort,\sbut\sthe\sparser\smight\sdo\sseveral\sreduce\nactions\sprior\sto\sthat\sabort\sand\sthose\sreduce\sactions\ssometimes\sneed\sa\nvalid\sExpr.\s(CVS\s3980) C Additional\sparsing\sbugs\sfixed.\s(CVS\s3981)
D 2007-05-11T00:20:08 D 2007-05-11T01:44:51
F Makefile.in 87b200ad9970907f76df734d29dff3d294c10935 F Makefile.in 87b200ad9970907f76df734d29dff3d294c10935
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -70,7 +70,7 @@ F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675
F src/date.c 6049db7d5a8fdf2c677ff7d58fa31d4f6593c988 F src/date.c 6049db7d5a8fdf2c677ff7d58fa31d4f6593c988
F src/delete.c 5c0d89b3ef7d48fe1f5124bfe8341f982747fe29 F src/delete.c 5c0d89b3ef7d48fe1f5124bfe8341f982747fe29
F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b
F src/expr.c 482db8506575b5b257b78cc4ca1e825731cceda4 F src/expr.c d890a38c2fed16440a3360f42516061b8e3cfad3
F src/func.c f57e0111eb0e6335d3673cd4dea3fd69aa9e8743 F src/func.c f57e0111eb0e6335d3673cd4dea3fd69aa9e8743
F src/hash.c 67b23e14f0257b69a3e8aa663e4eeadc1a2b6fd5 F src/hash.c 67b23e14f0257b69a3e8aa663e4eeadc1a2b6fd5
F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564 F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564
@@ -94,7 +94,7 @@ F src/os_win.c 3b6169038101d06c54b4f04662bfd44b6cf2f289
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c acfa86f50b71b7e289508b213bb88e68273d42a0 F src/pager.c acfa86f50b71b7e289508b213bb88e68273d42a0
F src/pager.h 94110a5570dca30d54a883e880a3633b2e4c05ae F src/pager.h 94110a5570dca30d54a883e880a3633b2e4c05ae
F src/parse.y 39b25cc7f9e1a1a999f367545192c35db644610d F src/parse.y 8451c5b04a599a8c0e637850dd28fc03340f44c9
F src/pragma.c 0703152b9edd6601eea95e1d474b3bc2962d7920 F src/pragma.c 0703152b9edd6601eea95e1d474b3bc2962d7920
F src/prepare.c 87c23644986b5e41a58bc76f05abebd899e00089 F src/prepare.c 87c23644986b5e41a58bc76f05abebd899e00089
F src/printf.c 05b233c7a39aec4c54c79ef87af24f0a6591175d F src/printf.c 05b233c7a39aec4c54c79ef87af24f0a6591175d
@@ -247,7 +247,7 @@ F test/fts2k.test 222d0b3bc8667753f18406aaea9906a6098ea016
F test/fts2l.test 4c53c89ce3919003765ff4fd8d98ecf724d97dd3 F test/fts2l.test 4c53c89ce3919003765ff4fd8d98ecf724d97dd3
F test/fts2m.test 4b30142ead6f3ed076e880a2a464064c5ad58c51 F test/fts2m.test 4b30142ead6f3ed076e880a2a464064c5ad58c51
F test/fts2n.test a70357e72742681eaebfdbe9007b87ff3b771638 F test/fts2n.test a70357e72742681eaebfdbe9007b87ff3b771638
F test/func.test 6f230b25b235cc1afcc7bd5a41baf7317018a8d1 F test/func.test bf30bac1c5ce10448ab739994268cf18f8b3fa30
F test/fuzz.test db1bffeeb367b0e9147a1822db5c8c17c6f0b2ab F test/fuzz.test db1bffeeb367b0e9147a1822db5c8c17c6f0b2ab
F test/fuzz2.test fdbea571808441c12c91e9cd038eb77b4692d42b F test/fuzz2.test fdbea571808441c12c91e9cd038eb77b4692d42b
F test/hook.test 7e7645fd9a033f79cce8fdff151e32715e7ec50a F test/hook.test 7e7645fd9a033f79cce8fdff151e32715e7ec50a
@@ -488,7 +488,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P a57afaff424448ffed8f2344e5eb461f503bfb6e P d146f01a02579339c5dc86bbe59f246bd6c05c63
R 1c4b57b77de749bc2a551005b3fab4dc R 7125d6d53e0b2202166323742c3b01c2
U drh U drh
Z 1451f40dc8d5cea45bc2414baa2bda16 Z 23c6aad98fcd55bc5de6b8a43a789f0e

View File

@@ -1 +1 @@
d146f01a02579339c5dc86bbe59f246bd6c05c63 d12a8924c6083cdff14990b4fd036ca386c2e34a

View File

@@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and ** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite. ** for generating VDBE code that evaluates expressions in SQLite.
** **
** $Id: expr.c,v 1.290 2007/05/11 00:20:08 drh Exp $ ** $Id: expr.c,v 1.291 2007/05/11 01:44:51 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@@ -280,10 +280,9 @@ Expr *sqlite3RegisterExpr(Parse *pParse, Token *pToken){
Vdbe *v = pParse->pVdbe; Vdbe *v = pParse->pVdbe;
Expr *p; Expr *p;
int depth; int depth;
static const Token zeroToken = { (u8*)"0", 0, 1 };
if( pParse->nested==0 ){ if( pParse->nested==0 ){
sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", pToken); sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", pToken);
return sqlite3Expr(TK_INTEGER, 0, 0, &zeroToken); return sqlite3Expr(TK_NULL, 0, 0, 0);
} }
if( v==0 ) return 0; if( v==0 ) return 0;
p = sqlite3Expr(TK_REGISTER, 0, 0, pToken); p = sqlite3Expr(TK_REGISTER, 0, 0, pToken);

View File

@@ -14,7 +14,7 @@
** the parser. Lemon will also generate a header file containing ** the parser. Lemon will also generate a header file containing
** numeric codes for all of the tokens. ** numeric codes for all of the tokens.
** **
** @(#) $Id: parse.y,v 1.225 2007/05/10 10:46:57 danielk1977 Exp $ ** @(#) $Id: parse.y,v 1.226 2007/05/11 01:44:52 drh Exp $
*/ */
// All token codes are small integers with #defines that begin with "TK_" // All token codes are small integers with #defines that begin with "TK_"
@@ -661,15 +661,12 @@ expr(A) ::= CAST(X) LP expr(E) AS typetoken(T) RP(Y). {
expr(A) ::= ID(X) LP distinct(D) exprlist(Y) RP(E). { expr(A) ::= ID(X) LP distinct(D) exprlist(Y) RP(E). {
if( Y->nExpr>SQLITE_MAX_FUNCTION_ARG ){ if( Y->nExpr>SQLITE_MAX_FUNCTION_ARG ){
sqlite3ErrorMsg(pParse, "too many arguments on function %T", &X); sqlite3ErrorMsg(pParse, "too many arguments on function %T", &X);
sqlite3ExprListDelete(Y); }
A = 0;
}else{
A = sqlite3ExprFunction(Y, &X); A = sqlite3ExprFunction(Y, &X);
sqlite3ExprSpan(A,&X,&E); sqlite3ExprSpan(A,&X,&E);
if( D && A ){ if( D && A ){
A->flags |= EP_Distinct; A->flags |= EP_Distinct;
} }
}
} }
expr(A) ::= ID(X) LP STAR RP(E). { expr(A) ::= ID(X) LP STAR RP(E). {
A = sqlite3ExprFunction(0, &X); A = sqlite3ExprFunction(0, &X);

View File

@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this file is testing built-in functions. # focus of this file is testing built-in functions.
# #
# $Id: func.test,v 1.65 2007/05/08 14:39:04 danielk1977 Exp $ # $Id: func.test,v 1.66 2007/05/11 01:44:52 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@@ -834,16 +834,18 @@ do_test func-22.12 {
do_test func-22.13 { do_test func-22.13 {
execsql {SELECT trim(' hi ','');} execsql {SELECT trim(' hi ','');}
} {{ hi }} } {{ hi }}
do_test func-22.14 { if {[db one {PRAGMA encoding}]=="UTF-8"} {
do_test func-22.14 {
execsql {SELECT hex(trim(x'c280e1bfbff48fbfbf6869',x'6162e1bfbfc280'))} execsql {SELECT hex(trim(x'c280e1bfbff48fbfbf6869',x'6162e1bfbfc280'))}
} {F48FBFBF6869} } {F48FBFBF6869}
do_test func-22.15 { do_test func-22.15 {
execsql {SELECT hex(trim(x'6869c280e1bfbff48fbfbf61', execsql {SELECT hex(trim(x'6869c280e1bfbff48fbfbf61',
x'6162e1bfbfc280f48fbfbf'))} x'6162e1bfbfc280f48fbfbf'))}
} {6869} } {6869}
do_test func-22.16 { do_test func-22.16 {
execsql {SELECT hex(trim(x'ceb1ceb2ceb3',x'ceb1'));} execsql {SELECT hex(trim(x'ceb1ceb2ceb3',x'ceb1'));}
} {CEB2CEB3} } {CEB2CEB3}
}
do_test func-22.20 { do_test func-22.20 {
execsql {SELECT typeof(trim(NULL));} execsql {SELECT typeof(trim(NULL));}
} {null} } {null}