From: drh Date: Fri, 12 Jun 2009 12:04:16 +0000 (+0000) Subject: Enable the SQLITE_LIMIT_FUNCTION_ARG limiter. (CVS 6753) X-Git-Tag: version-3.6.15~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=994704d1cb9b3e278d536281984308bc6327aa0c;p=thirdparty%2Fsqlite.git Enable the SQLITE_LIMIT_FUNCTION_ARG limiter. (CVS 6753) FossilOrigin-Name: a17e3317176772446abdc8ebe6fb6f0d3b7ac018 --- diff --git a/manifest b/manifest index 2b0201152b..eed55e2626 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sa\sC++-ism\sfrom\sthe\scode.\s\sTicket\s#3912.\s(CVS\s6752) -D 2009-06-12T11:42:12 +C Enable\sthe\sSQLITE_LIMIT_FUNCTION_ARG\slimiter.\s(CVS\s6753) +D 2009-06-12T12:04:16 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 8b8fb7823264331210cddf103831816c286ba446 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -148,7 +148,7 @@ F src/os_unix.c e55d977c516ed880a2f83f0610b019efd9f8bc06 F src/os_win.c 725c38a524d168ce280446ad8761d731bc516405 F src/pager.c efdd56a49622fe87d5cf4b6e69aeb62b45bcb9b0 F src/pager.h 73f481a308a873ccd626d97331c081db3b53e2e5 -F src/parse.y 90bcb72db462fe4557cf96aabf8b94c39aa887fa +F src/parse.y d4bade53de7a0ed17d6a06f89b171492c844502e F src/pcache.c 395f752a13574120bd7513a400ba02a265aaa76d F src/pcache.h 9b927ccc5a538e31b4c3bc7eec4f976db42a1324 F src/pcache1.c 97e7e8e6e34026fb43b47d08532b0c02e959c26c @@ -555,7 +555,7 @@ F test/speed3.test e312d7e442a5047d730569fdae2ba99bc94e1a13 F test/speed4.test abc0ad3399dcf9703abed2fff8705e4f8e416715 F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa F test/speed4p.test 0e51908951677de5a969b723e03a27a1c45db38b -F test/sqllimits1.test 2f7ca3c7e7cef39a9c499e941e98b7f1708c4780 +F test/sqllimits1.test 06c2c6cbdbfa03af15a1a61ba8cae675d9c8fe31 F test/subquery.test b524f57c9574b2c0347045b4510ef795d4686796 F test/subselect.test d24fd8757daf97dafd2e889c73ea4c4272dcf4e4 F test/substr.test 18f57c4ca8a598805c4d64e304c418734d843c1a @@ -734,7 +734,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746 -P 6197b492714e16396941ae6ba61f90f708d54728 -R 35a287ed30a5a4abe3f9902d086b75b9 +P bc729bc3e6f6e3570103e646080eb119311b0fa7 +R dcf2433cc76e84aaf0238602ef723d94 U drh -Z ccc38ec38f2ea3ed8385702ad4474d78 +Z c579fe02fd243a6ebb0b2fb7a4beda49 diff --git a/manifest.uuid b/manifest.uuid index 579bdfc1f0..0239aeef6a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bc729bc3e6f6e3570103e646080eb119311b0fa7 \ No newline at end of file +a17e3317176772446abdc8ebe6fb6f0d3b7ac018 \ No newline at end of file diff --git a/src/parse.y b/src/parse.y index f415d5fff1..483757ff0c 100644 --- a/src/parse.y +++ b/src/parse.y @@ -14,7 +14,7 @@ ** the parser. Lemon will also generate a header file containing ** numeric codes for all of the tokens. ** -** @(#) $Id: parse.y,v 1.280 2009/06/12 03:47:37 drh Exp $ +** @(#) $Id: parse.y,v 1.281 2009/06/12 12:04:16 drh Exp $ */ // All token codes are small integers with #defines that begin with "TK_" @@ -789,7 +789,7 @@ expr(A) ::= CAST(X) LP expr(E) AS typetoken(T) RP(Y). { } %endif SQLITE_OMIT_CAST expr(A) ::= ID(X) LP distinct(D) exprlist(Y) RP(E). { - if( Y && Y->nExpr>SQLITE_MAX_FUNCTION_ARG ){ + if( Y && Y->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){ sqlite3ErrorMsg(pParse, "too many arguments on function %T", &X); } A.pExpr = sqlite3ExprFunction(pParse, Y, &X); diff --git a/test/sqllimits1.test b/test/sqllimits1.test index f7f5c2baa5..933a94f942 100644 --- a/test/sqllimits1.test +++ b/test/sqllimits1.test @@ -12,7 +12,7 @@ # This file contains tests to verify that the limits defined in # sqlite source file limits.h are enforced. # -# $Id: sqllimits1.test,v 1.31 2008/07/15 00:27:35 drh Exp $ +# $Id: sqllimits1.test,v 1.32 2009/06/12 12:04:16 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -718,36 +718,35 @@ if 0 { # Test the SQLITE_LIMIT_FUNCTION_ARG limit works. Test case names # match the pattern "sqllimits1-11.*". # -do_test sqllimits1-11.1 { - set max $::SQLITE_MAX_FUNCTION_ARG - set vals [list] - for {set i 0} {$i < $SQLITE_MAX_FUNCTION_ARG} {incr i} { - lappend vals $i - } - catchsql "SELECT max([join $vals ,])" -} "0 [expr {$::SQLITE_MAX_FUNCTION_ARG - 1}]" -do_test sqllimits1-11.2 { - set max $::SQLITE_MAX_FUNCTION_ARG - set vals [list] - for {set i 0} {$i <= $SQLITE_MAX_FUNCTION_ARG} {incr i} { - lappend vals $i - } - catchsql "SELECT max([join $vals ,])" -} {1 {too many arguments on function max}} - -# Test that it is SQLite, and not the implementation of the -# user function that is throwing the error. -proc myfunc {args} {error "I don't like to be called!"} -do_test sqllimits1-11.2 { - db function myfunc myfunc - set max $::SQLITE_MAX_FUNCTION_ARG - set vals [list] - for {set i 0} {$i <= $SQLITE_MAX_FUNCTION_ARG} {incr i} { - lappend vals $i - } - catchsql "SELECT myfunc([join $vals ,])" -} {1 {too many arguments on function myfunc}} - +for {set max 5} {$max<=$SQLITE_MAX_FUNCTION_ARG} {incr max} { + do_test sqllimits1-11.$max.1 { + set vals [list] + sqlite3_limit db SQLITE_LIMIT_FUNCTION_ARG $::max + for {set i 0} {$i < $::max} {incr i} { + lappend vals $i + } + catchsql "SELECT max([join $vals ,])" + } "0 [expr {$::max - 1}]" + do_test sqllimits1-11.$max.2 { + set vals [list] + for {set i 0} {$i <= $::max} {incr i} { + lappend vals $i + } + catchsql "SELECT max([join $vals ,])" + } {1 {too many arguments on function max}} + + # Test that it is SQLite, and not the implementation of the + # user function that is throwing the error. + proc myfunc {args} {error "I don't like to be called!"} + do_test sqllimits1-11.$max.2 { + db function myfunc myfunc + set vals [list] + for {set i 0} {$i <= $::max} {incr i} { + lappend vals $i + } + catchsql "SELECT myfunc([join $vals ,])" + } {1 {too many arguments on function myfunc}} +} #-------------------------------------------------------------------- # Test cases sqllimits1-12.*: Test the SQLITE_MAX_ATTACHED limit.