From: danielk1977 Date: Tue, 8 May 2007 16:13:45 +0000 (+0000) Subject: Add a test case that uses a trigger to insert many rows to sqllimits1.test. (CVS... X-Git-Tag: version-3.4.0~128 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=428de1c03a7ebe93cdebbcd041597015ab7f8672;p=thirdparty%2Fsqlite.git Add a test case that uses a trigger to insert many rows to sqllimits1.test. (CVS 3953) FossilOrigin-Name: 6368222558d00f968b49f862bfe672573e86fbcf --- diff --git a/manifest b/manifest index 18439c6c66..1df6ab118a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\snew\stest\sfile\ssqllimits1.test.\s(CVS\s3952) -D 2007-05-08T15:59:06 +C Add\sa\stest\scase\sthat\suses\sa\strigger\sto\sinsert\smany\srows\sto\ssqllimits1.test.\s(CVS\s3953) +D 2007-05-08T16:13:45 F Makefile.in 87b200ad9970907f76df734d29dff3d294c10935 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -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 180c2bc1a13ae67adca747c333eba3211409abf3 +F test/sqllimits1.test b88ffc18cf8a4bcb6608cacaa692ede4b7511a2a 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 0cf518ceebda8e7421d054813f97cc447d292344 -R ddfeace665d99b6082fb9407968ef94f +P c8974603976ebc02edbc9ab271e87e57f8eb365e +R 14fd5bdefc5c8b6717aa13ebe2e75f62 U danielk1977 -Z f31fe2890398ab75828f21106fdbea89 +Z f532c476b7aaba8d810fc10e1b62322d diff --git a/manifest.uuid b/manifest.uuid index 403273df89..b1d76be22a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c8974603976ebc02edbc9ab271e87e57f8eb365e \ No newline at end of file +6368222558d00f968b49f862bfe672573e86fbcf \ No newline at end of file diff --git a/test/sqllimits1.test b/test/sqllimits1.test index 0369ebc2c3..09ee6be810 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.1 2007/05/08 15:59:06 danielk1977 Exp $ +# $Id: sqllimits1.test,v 1.2 2007/05/08 16:13:45 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -44,7 +44,7 @@ do_test sqllimits-1.4 { } {1 {string or blob too big}} #-------------------------------------------------------------------- -# Test cases sqllimits-1.* test that the SQLITE_MAX_SQL limit +# Test cases sqllimits-2.* test that the SQLITE_MAX_SQL limit # is enforced. # do_test sqllimits-2.1 { @@ -53,5 +53,90 @@ do_test sqllimits-2.1 { catchsql $sql } {1 {String or BLOB exceeded size limit}} +#-------------------------------------------------------------------- +# Test cases sqllimits-3.* test that the limit set using the +# max_page_count pragma. +# +do_test sqllimits-3.1 { + execsql { + PRAGMA max_page_count = 1000; + } +} {1000} +do_test sqllimits-3.2 { + execsql { + CREATE TABLE trig (a INTEGER, b INTEGER); + } + + # Set up a tree of triggers to fire when a row is inserted + # into table "trig". + # + # INSERT -> insert_b -> update_b -> insert_a -> update_a (chain 1) + # -> update_a -> insert_a -> update_b (chain 2) + # -> insert_a -> update_b -> insert_b -> update_a (chain 3) + # -> update_a -> insert_b -> update_b (chain 4) + # + # Table starts with N rows. + # + # Chain 1: insert_b (update N rows) + # -> update_b (insert 1 rows) + # -> insert_a (update N rows) + # -> update_a (insert 1 rows) + # + # chains 2, 3 and 4 are similar. Each inserts more than N^2 rows, where + # N is the number of rows at the conclusion of the previous chain. + # + # Therefore, a single insert adds (N^16 plus some) rows to the database. + # A really long loop... + # + execsql { + CREATE TRIGGER update_b BEFORE UPDATE ON trig + FOR EACH ROW BEGIN + INSERT INTO trig VALUES (65, 'update_b'); + END; + + CREATE TRIGGER update_a AFTER UPDATE ON trig + FOR EACH ROW BEGIN + INSERT INTO trig VALUES (65, 'update_a'); + END; + + CREATE TRIGGER insert_b BEFORE INSERT ON trig + FOR EACH ROW BEGIN + UPDATE trig SET a = 1; + END; + + CREATE TRIGGER insert_a AFTER INSERT ON trig + FOR EACH ROW BEGIN + UPDATE trig SET a = 1; + END; + } +} {} + +do_test sqllimits1-3.3 { + execsql { + INSERT INTO trig VALUES (1,1); + } +} {} + +do_test sqllimits1-3.4 { + execsql { + SELECT COUNT(*) FROM trig; + } +} {7} + +# This tries to insert so many rows it fills up the database (limited +# to 1MB, so not that noteworthy an achievement). +# +do_test sqllimits1-3.5 { + catchsql { + INSERT INTO trig VALUES (1,10); + } +} {1 {database or disk is full}} + +do_test sqllimits1-3.6 { + catchsql { + SELECT COUNT(*) FROM trig; + } +} {0 7} + finish_test