Add further test cases for compile time limits. (CVS 3963)
FossilOrigin-Name: 9bf2c594a48a4661700f0833562ee2b3ff7b761c
This commit is contained in:
parent
b56fe1ff27
commit
832b2664e6
18
manifest
18
manifest
@ -1,5 +1,5 @@
|
||||
C Fix\senforcement\sof\sthe\sLIKE_PATTERN\slimit.\s(CVS\s3962)
|
||||
D 2007-05-09T08:24:44
|
||||
C Add\sfurther\stest\scases\sfor\scompile\stime\slimits.\s(CVS\s3963)
|
||||
D 2007-05-09T11:37:23
|
||||
F Makefile.in 87b200ad9970907f76df734d29dff3d294c10935
|
||||
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
|
||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||
@ -70,7 +70,7 @@ F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675
|
||||
F src/date.c 6049db7d5a8fdf2c677ff7d58fa31d4f6593c988
|
||||
F src/delete.c 5c0d89b3ef7d48fe1f5124bfe8341f982747fe29
|
||||
F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b
|
||||
F src/expr.c eb91a54d0c2a3bebfcf91deda95508a188c2ed63
|
||||
F src/expr.c 1f3c365fc5aa2a03395cf470346f3646382469c2
|
||||
F src/func.c 6282d2025d8e0db80b43783a4778cbb04e98f2f6
|
||||
F src/hash.c 67b23e14f0257b69a3e8aa663e4eeadc1a2b6fd5
|
||||
F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564
|
||||
@ -119,7 +119,7 @@ F src/test9.c c0f38f7795cc51d37db6c63874d90f40f10d0f0e
|
||||
F src/test_async.c 9d326ceda4306bcab252b8f7e8e480ed45d7ccb6
|
||||
F src/test_autoext.c 855157d97aa28cf84233847548bfacda21807436
|
||||
F src/test_btree.c 882d59acad48bab3b1fe3daf3645059b590cfc79
|
||||
F src/test_config.c c267103cac3733a0d14a0b8d3fa8c22b22fb468a
|
||||
F src/test_config.c 4c1db31befcbf6206766bbbb429d0e6a1254cdc7
|
||||
F src/test_hexio.c 32204b5ce281ebc85f789c69c4ec725129e7e7f5
|
||||
F src/test_loadext.c 22065d601a18878e5542191001f0eaa5d77c0ed8
|
||||
F src/test_md5.c 6c42bc0a3c0b54be34623ff77a0eec32b2fa96e3
|
||||
@ -167,7 +167,7 @@ F test/avtrans.test b77740800de0d2cdcf394ef94d2d61225a1941d8
|
||||
F test/between.test 16b1776c6323faadb097a52d673e8e3d8be7d070
|
||||
F test/bigfile.test ebc9ce9216e08bead63734ab816d0f27858f3b80
|
||||
F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747
|
||||
F test/bind.test 941a424e7722dd8994c2d503b28d00e6a8f87f23
|
||||
F test/bind.test b2c9938805a78adbe5953dbaaee1d6f9afce370b
|
||||
F test/bindxfer.test b9a57f66dbd317feeefa28bd65b6576f1592ee98
|
||||
F test/blob.test 28c3b25150684ee3d108bb78cfb67a472deef2f0
|
||||
F test/btree.test 8b6168980efdd194289798f19d4c81434f6d3a66
|
||||
@ -340,7 +340,7 @@ F test/shared_err.test cc528f6e78665787e93d9ce3a782a2ce5179d821
|
||||
F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5
|
||||
F test/speed1.test 22e1b27af0683ed44dcd2f93ed817a9c3e65084a
|
||||
F test/speed2.test 53177056baf6556dcbdcf032bbdfc41c1aa74ded
|
||||
F test/sqllimits1.test 7fff0aaf860bdd65ba9c45969f1d17ca4f6c9a8c
|
||||
F test/sqllimits1.test f06a5574698513b3d3e48892b36bc0549ef87295
|
||||
F test/subquery.test ae324ee928c5fb463a3ce08a8860d6e7f1ca5797
|
||||
F test/subselect.test 974e87f8fc91c5f00dd565316d396a5a6c3106c4
|
||||
F test/sync.test d05397b8f89f423dd6dba528692019ab036bc1c3
|
||||
@ -486,7 +486,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
||||
P 03349ec0be208fd8701d94515a2ed13129cb8422
|
||||
R f2e9dd7272549bf53a2372232b2e3902
|
||||
P 8819617b7cf7ccd64bf6bb4ba208f37126964ec2
|
||||
R 54a1b89c49a017368635873118232ab3
|
||||
U danielk1977
|
||||
Z ddbbd47818532a8c09b0749d1c22ef8a
|
||||
Z 4e9b895f8f222ff1332fffb6b3691a1c
|
||||
|
@ -1 +1 @@
|
||||
8819617b7cf7ccd64bf6bb4ba208f37126964ec2
|
||||
9bf2c594a48a4661700f0833562ee2b3ff7b761c
|
@ -12,7 +12,7 @@
|
||||
** This file contains routines used for analyzing expressions and
|
||||
** for generating VDBE code that evaluates expressions in SQLite.
|
||||
**
|
||||
** $Id: expr.c,v 1.287 2007/05/08 18:04:46 danielk1977 Exp $
|
||||
** $Id: expr.c,v 1.288 2007/05/09 11:37:23 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@ -413,6 +413,9 @@ void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr){
|
||||
}
|
||||
}
|
||||
}
|
||||
if( !pParse->nErr && pParse->nVar>SQLITE_MAX_VARIABLE_NUMBER ){
|
||||
sqlite3ErrorMsg(pParse, "too many SQL variables");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -16,7 +16,7 @@
|
||||
** The focus of this file is providing the TCL testing layer
|
||||
** access to compile-time constants.
|
||||
**
|
||||
** $Id: test_config.c,v 1.2 2007/05/09 08:24:44 danielk1977 Exp $
|
||||
** $Id: test_config.c,v 1.3 2007/05/09 11:37:23 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "tcl.h"
|
||||
@ -442,6 +442,11 @@ static void set_options(Tcl_Interp *interp){
|
||||
Tcl_LinkVar(interp, "SQLITE_MAX_LIKE_PATTERN_LENGTH",
|
||||
(char*)&sqlite_max_like_pattern, TCL_LINK_INT|TCL_LINK_READ_ONLY);
|
||||
}
|
||||
{
|
||||
static int sqlite_max_attached = SQLITE_MAX_ATTACHED;
|
||||
Tcl_LinkVar(interp, "SQLITE_MAX_ATTACHED",
|
||||
(char*)&sqlite_max_attached, TCL_LINK_INT|TCL_LINK_READ_ONLY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this script testing the sqlite_bind API.
|
||||
#
|
||||
# $Id: bind.test,v 1.38 2006/06/27 20:06:45 drh Exp $
|
||||
# $Id: bind.test,v 1.39 2007/05/09 11:37:23 danielk1977 Exp $
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
@ -358,16 +358,16 @@ catch {sqlite3_finalize $VM}
|
||||
do_test bind-9.4 {
|
||||
set VM [
|
||||
sqlite3_prepare $DB {
|
||||
INSERT INTO t2(a,b,c,d) VALUES(?1,?999,?,?)
|
||||
INSERT INTO t2(a,b,c,d) VALUES(?1,?997,?,?)
|
||||
} -1 TAIL
|
||||
]
|
||||
sqlite3_bind_parameter_count $VM
|
||||
} {1001}
|
||||
} {999}
|
||||
do_test bind-9.5 {
|
||||
sqlite3_bind_int $VM 1 1
|
||||
sqlite3_bind_int $VM 999 999
|
||||
sqlite3_bind_int $VM 1000 1000
|
||||
sqlite3_bind_int $VM 1001 1001
|
||||
sqlite3_bind_int $VM 997 999
|
||||
sqlite3_bind_int $VM 998 1000
|
||||
sqlite3_bind_int $VM 999 1001
|
||||
sqlite3_step $VM
|
||||
} SQLITE_DONE
|
||||
do_test bind-9.6 {
|
||||
|
@ -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.4 2007/05/09 08:24:44 danielk1977 Exp $
|
||||
# $Id: sqllimits1.test,v 1.5 2007/05/09 11:37:23 danielk1977 Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -24,16 +24,17 @@ source $testdir/tester.tcl
|
||||
# sqllimits-3.*: SQLITE_MAX_PAGE_COUNT
|
||||
# sqllimits-4.*: SQLITE_MAX_COLUMN
|
||||
#
|
||||
# Todo:
|
||||
#
|
||||
# sqllimits-5.*: SQLITE_MAX_EXPR_LENGTH (sqlite todo)
|
||||
# sqllimits-6.*: SQLITE_MAX_VDBE_OP (sqlite todo)
|
||||
# sqllimits-7.*: SQLITE_MAX_FUNCTION_ARG
|
||||
# sqllimits-8.*: SQLITE_MAX_ATTACHED
|
||||
# sqllimits-9.*: SQLITE_MAX_VARIABLE_NUMBER
|
||||
# sqllimits-10.*: SQLITE_MAX_PAGE_SIZE
|
||||
# sqllimits-11.*: SQLITE_MAX_PAGE_COUNT
|
||||
# sqllimits-12.*: SQLITE_MAX_LIKE_PATTERN_LENGTH
|
||||
# sqllimits-11.*: SQLITE_MAX_LIKE_PATTERN_LENGTH
|
||||
#
|
||||
# Todo:
|
||||
#
|
||||
# sqllimits-5.*: SQLITE_MAX_EXPR_LENGTH (sqlite todo)
|
||||
# sqllimits-6.*: SQLITE_MAX_VDBE_OP (sqlite todo)
|
||||
#
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
@ -241,9 +242,115 @@ do_test sqllimits-1.4.9 {
|
||||
# limit is enforced. The limit refers to the number of terms in
|
||||
# the expression.
|
||||
#
|
||||
# TODO
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Test cases sqllimits-12.* verify that the
|
||||
# Test cases sqllimits-6.* test that the SQLITE_MAX_VDBE_OP
|
||||
# limit works as expected. The limit refers to the number of opcodes
|
||||
# in a single VDBE program.
|
||||
#
|
||||
# TODO
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Test the SQLITE_MAX_FUNCTION_ARG limit works. Test case names
|
||||
# match the pattern "sqllimits-7.*".
|
||||
#
|
||||
do_test sqllimits-1.7.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 sqllimits-1.7.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 sqllimits-1.7.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}}
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Test cases sqllimits-8.*: Test the SQLITE_MAX_ATTACHED limit.
|
||||
#
|
||||
# TODO
|
||||
do_test sqllimits-1.8.1 {
|
||||
set max $::SQLITE_MAX_ATTACHED
|
||||
for {set i 0} {$i < ($max)} {incr i} {
|
||||
execsql "ATTACH 'test${i}.db' AS aux${i}"
|
||||
}
|
||||
catchsql "ATTACH 'test${i}.db' AS aux${i}"
|
||||
} "1 {too many attached databases - max $::SQLITE_MAX_ATTACHED}"
|
||||
do_test sqllimits-1.8.2 {
|
||||
set max $::SQLITE_MAX_ATTACHED
|
||||
for {set i 0} {$i < ($max)} {incr i} {
|
||||
execsql "DETACH aux${i}"
|
||||
}
|
||||
} {}
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Test cases sqllimits-9.*: Check that the SQLITE_MAX_VARIABLE_NUMBER
|
||||
# limit works.
|
||||
#
|
||||
do_test sqllimits-1.9.1 {
|
||||
set max $::SQLITE_MAX_VARIABLE_NUMBER
|
||||
catchsql "SELECT ?[expr {$max+1}] FROM t1"
|
||||
} "1 {variable number must be between ?1 and ?$::SQLITE_MAX_VARIABLE_NUMBER}"
|
||||
do_test sqllimits-1.9.2 {
|
||||
set max $::SQLITE_MAX_VARIABLE_NUMBER
|
||||
set vals [list]
|
||||
for {set i 0} {$i < ($max+3)} {incr i} {
|
||||
lappend vals ?
|
||||
}
|
||||
catchsql "SELECT [join $vals ,] FROM t1"
|
||||
} "1 {too many SQL variables}"
|
||||
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# sqllimits-10.*: Test the SQLITE_MAX_PAGE_SIZE define is enforced.
|
||||
# This is probably tested elsewhere too (pagerX.test). Attempts
|
||||
# to raise the page size above this limit are silently ignored.
|
||||
#
|
||||
do_test sqllimits-1.10.1 {
|
||||
db close
|
||||
file delete -force test.db test.db-journal
|
||||
sqlite3 db test.db
|
||||
set max $::SQLITE_MAX_PAGE_SIZE
|
||||
catchsql "PRAGMA page_size = [expr {$max*2}]"
|
||||
} {0 {}}
|
||||
do_test sqllimits-1.10.2 {
|
||||
catchsql "PRAGMA page_size"
|
||||
} {0 1024}
|
||||
do_test sqllimits-1.10.3 {
|
||||
set max $::SQLITE_MAX_PAGE_SIZE
|
||||
catchsql "PRAGMA page_size = $max"
|
||||
} {0 {}}
|
||||
do_test sqllimits-1.10.4 {
|
||||
execsql "pragma page_size"
|
||||
} $::SQLITE_MAX_PAGE_SIZE
|
||||
do_test sqllimits-1.10.5 {
|
||||
set max $::SQLITE_MAX_PAGE_SIZE
|
||||
execsql "pragma page_size = [expr {$max - 5}]"
|
||||
execsql "pragma page_size"
|
||||
} $::SQLITE_MAX_PAGE_SIZE
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Test cases sqllimits-11.* verify that the
|
||||
# SQLITE_MAX_LIKE_PATTERN_LENGTH limit is enforced. This limit only
|
||||
# applies to the built-in LIKE operator, supplying an external
|
||||
# implementation by overriding the like() scalar function bypasses
|
||||
@ -253,7 +360,7 @@ do_test sqllimits-1.4.9 {
|
||||
# the left-hand-side of the LIKE operator (the string being tested
|
||||
# against the pattern).
|
||||
#
|
||||
do_test sqllimits-1.12.1 {
|
||||
do_test sqllimits-1.11.1 {
|
||||
set max $::SQLITE_MAX_LIKE_PATTERN_LENGTH
|
||||
set ::pattern [string repeat "A%" [expr $max/2]]
|
||||
set ::string [string repeat "A" [expr {$max*2}]]
|
||||
@ -261,7 +368,7 @@ do_test sqllimits-1.12.1 {
|
||||
SELECT $::string LIKE $::pattern;
|
||||
}
|
||||
} {1}
|
||||
do_test sqllimits-1.12.2 {
|
||||
do_test sqllimits-1.11.2 {
|
||||
set max $::SQLITE_MAX_LIKE_PATTERN_LENGTH
|
||||
set ::pattern [string repeat "A%" [expr {($max/2) + 1}]]
|
||||
set ::string [string repeat "A" [expr {$max*2}]]
|
||||
|
Loading…
Reference in New Issue
Block a user