Increase maximum row size to 1MB. (CVS 300)
FossilOrigin-Name: 7dd58fad398253608f55867cf1c7749eef005657
This commit is contained in:
+114
-4
@@ -12,7 +12,7 @@
|
||||
# focus of this file is stressing the library by putting large amounts
|
||||
# of data in a single row of a table.
|
||||
#
|
||||
# $Id: bigrow.test,v 1.1 2001/09/24 03:12:40 drh Exp $
|
||||
# $Id: bigrow.test,v 1.2 2001/11/04 18:32:48 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -50,11 +50,22 @@ do_test bigrow-1.3 {
|
||||
execsql {SELECT b FROM t1}
|
||||
} [list $::big1]
|
||||
do_test bigrow-1.4 {
|
||||
set sql "INSERT INTO t1 VALUES('abc',"
|
||||
append sql "'[string range $::bigstr 0 65520]', 'xyz');"
|
||||
set ::big2 [string range $::bigstr 0 65520]
|
||||
set sql "INSERT INTO t1 VALUES('abc2',"
|
||||
append sql "'$::big2', 'xyz2');"
|
||||
set r [catch {execsql $sql} msg]
|
||||
lappend r $msg
|
||||
} {1 {too much data for one table row}}
|
||||
} {0 {}}
|
||||
do_test bigrow-1.4.1 {
|
||||
execsql {SELECT b FROM t1 ORDER BY c}
|
||||
} [list $::big1 $::big2]
|
||||
do_test bigrow-1.4.2 {
|
||||
execsql {SELECT c FROM t1 ORDER BY c}
|
||||
} {xyz xyz2}
|
||||
do_test bigrow-1.4.3 {
|
||||
execsql {DELETE FROM t1 WHERE a='abc2'}
|
||||
execsql {SELECT c FROM t1}
|
||||
} {xyz}
|
||||
|
||||
do_test bigrow-1.5 {
|
||||
execsql {
|
||||
@@ -101,5 +112,104 @@ do_test bigrow-2.3 {
|
||||
}
|
||||
execsql "SELECT b FROM t1 WHERE a=='$::big1'"
|
||||
} {abc}
|
||||
catch {unset ::bigstr}
|
||||
catch {unset ::big1}
|
||||
catch {unset ::big2}
|
||||
|
||||
# Mosts of the tests above were created back when rows were limited in
|
||||
# size to 64K. Now rows can be much bigger. Test that logic. Also
|
||||
# make sure things work correctly at the transition boundries between
|
||||
# row sizes of 256 to 257 bytes and from 65536 to 65537 bytes.
|
||||
#
|
||||
# We begin by testing the 256..257 transition.
|
||||
#
|
||||
do_test bigrow-3.1 {
|
||||
execsql {
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1(a,b,c) VALUES('one','abcdefghijklmnopqrstuvwxyz0123','hi');
|
||||
}
|
||||
execsql {SELECT a,length(b),c FROM t1}
|
||||
} {one 30 hi}
|
||||
do_test bigrow-3.2 {
|
||||
execsql {
|
||||
UPDATE t1 SET b=b||b;
|
||||
UPDATE t1 SET b=b||b;
|
||||
UPDATE t1 SET b=b||b;
|
||||
}
|
||||
execsql {SELECT a,length(b),c FROM t1}
|
||||
} {one 240 hi}
|
||||
for {set i 1} {$i<10} {incr i} {
|
||||
do_test bigrow-3.3.$i {
|
||||
execsql "UPDATE t1 SET b=b||'$i'"
|
||||
execsql {SELECT a,length(b),c FROM t1}
|
||||
} "one [expr {240+$i}] hi"
|
||||
}
|
||||
|
||||
# Now test the 65536..65537 row-size transition.
|
||||
#
|
||||
do_test bigrow-4.1 {
|
||||
execsql {
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1(a,b,c) VALUES('one','abcdefghijklmnopqrstuvwxyz0123','hi');
|
||||
}
|
||||
execsql {SELECT a,length(b),c FROM t1}
|
||||
} {one 30 hi}
|
||||
do_test bigrow-4.2 {
|
||||
execsql {
|
||||
UPDATE t1 SET b=b||b;
|
||||
UPDATE t1 SET b=b||b;
|
||||
UPDATE t1 SET b=b||b;
|
||||
UPDATE t1 SET b=b||b;
|
||||
UPDATE t1 SET b=b||b;
|
||||
UPDATE t1 SET b=b||b;
|
||||
UPDATE t1 SET b=b||b;
|
||||
UPDATE t1 SET b=b||b;
|
||||
UPDATE t1 SET b=b||b;
|
||||
UPDATE t1 SET b=b||b;
|
||||
UPDATE t1 SET b=b||b;
|
||||
UPDATE t1 SET b=b||b;
|
||||
}
|
||||
execsql {SELECT a,length(b),c FROM t1}
|
||||
} {one 122880 hi}
|
||||
do_test bigrow-4.3 {
|
||||
execsql {
|
||||
UPDATE t1 SET b=substr(b,0,65515)
|
||||
}
|
||||
execsql {SELECT a,length(b),c FROM t1}
|
||||
} {one 65515 hi}
|
||||
for {set i 1} {$i<10} {incr i} {
|
||||
do_test bigrow-4.4.$i {
|
||||
execsql "UPDATE t1 SET b=b||'$i'"
|
||||
execsql {SELECT a,length(b),c FROM t1}
|
||||
} "one [expr {65515+$i}] hi"
|
||||
}
|
||||
|
||||
# Check to make sure the library recovers safely if a row contains
|
||||
# too much data.
|
||||
#
|
||||
do_test bigrow-5.1 {
|
||||
execsql {
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1(a,b,c) VALUES('one','abcdefghijklmnopqrstuvwxyz0123','hi');
|
||||
}
|
||||
execsql {SELECT a,length(b),c FROM t1}
|
||||
} {one 30 hi}
|
||||
set i 1
|
||||
for {set sz 60} {$sz<1048560} {incr sz $sz} {
|
||||
do_test bigrow-5.2.$i {
|
||||
execsql {
|
||||
UPDATE t1 SET b=b||b;
|
||||
SELECT a,length(b),c FROM t1;
|
||||
}
|
||||
} "one $sz hi"
|
||||
incr i
|
||||
}
|
||||
do_test bigrow-5.3 {
|
||||
set r [catch {execsql {UPDATE t1 SET b=b||b}} msg]
|
||||
lappend r $msg
|
||||
} {1 {too much data for one table row}}
|
||||
do_test bigrow-5.4 {
|
||||
execsql {DROP TABLE t1}
|
||||
} {}
|
||||
|
||||
finish_test
|
||||
|
||||
Reference in New Issue
Block a user