Index: src/expr.c ================================================================== --- src/expr.c +++ src/expr.c @@ -10,11 +10,11 @@ ** ************************************************************************* ** This file contains routines used for analyzing expressions and ** 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 /* @@ -278,14 +278,13 @@ */ Expr *sqlite3RegisterExpr(Parse *pParse, Token *pToken){ Vdbe *v = pParse->pVdbe; Expr *p; int depth; - static const Token zeroToken = { (u8*)"0", 0, 1 }; if( pParse->nested==0 ){ 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; p = sqlite3Expr(TK_REGISTER, 0, 0, pToken); if( p==0 ){ return 0; /* Malloc failed */ 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.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_" %token_prefix TK_ @@ -659,18 +659,15 @@ } %endif SQLITE_OMIT_CAST expr(A) ::= ID(X) LP distinct(D) exprlist(Y) RP(E). { if( Y->nExpr>SQLITE_MAX_FUNCTION_ARG ){ sqlite3ErrorMsg(pParse, "too many arguments on function %T", &X); - sqlite3ExprListDelete(Y); - A = 0; - }else{ - A = sqlite3ExprFunction(Y, &X); - sqlite3ExprSpan(A,&X,&E); - if( D && A ){ - A->flags |= EP_Distinct; - } + } + A = sqlite3ExprFunction(Y, &X); + sqlite3ExprSpan(A,&X,&E); + if( D && A ){ + A->flags |= EP_Distinct; } } expr(A) ::= ID(X) LP STAR RP(E). { A = sqlite3ExprFunction(0, &X); sqlite3ExprSpan(A,&X,&E); Index: test/func.test ================================================================== --- test/func.test +++ test/func.test @@ -9,11 +9,11 @@ # #*********************************************************************** # This file implements regression tests for SQLite library. The # 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] source $testdir/tester.tcl # Create a table to work with. @@ -832,20 +832,22 @@ execsql {SELECT rtrim('xyxzy hi zzzy','xyz');} } {{xyxzy hi }} do_test func-22.13 { execsql {SELECT trim(' hi ','');} } {{ hi }} -do_test func-22.14 { - execsql {SELECT hex(trim(x'c280e1bfbff48fbfbf6869',x'6162e1bfbfc280'))} -} {F48FBFBF6869} -do_test func-22.15 { - execsql {SELECT hex(trim(x'6869c280e1bfbff48fbfbf61', - x'6162e1bfbfc280f48fbfbf'))} -} {6869} -do_test func-22.16 { - execsql {SELECT hex(trim(x'ceb1ceb2ceb3',x'ceb1'));} -} {CEB2CEB3} +if {[db one {PRAGMA encoding}]=="UTF-8"} { + do_test func-22.14 { + execsql {SELECT hex(trim(x'c280e1bfbff48fbfbf6869',x'6162e1bfbfc280'))} + } {F48FBFBF6869} + do_test func-22.15 { + execsql {SELECT hex(trim(x'6869c280e1bfbff48fbfbf61', + x'6162e1bfbfc280f48fbfbf'))} + } {6869} + do_test func-22.16 { + execsql {SELECT hex(trim(x'ceb1ceb2ceb3',x'ceb1'));} + } {CEB2CEB3} +} do_test func-22.20 { execsql {SELECT typeof(trim(NULL));} } {null} do_test func-22.21 { execsql {SELECT typeof(trim(NULL,'xyz'));}