1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/delete3.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,57 @@
1.4 +# 2005 August 24
1.5 +#
1.6 +# The author disclaims copyright to this source code. In place of
1.7 +# a legal notice, here is a blessing:
1.8 +#
1.9 +# May you do good and not evil.
1.10 +# May you find forgiveness for yourself and forgive others.
1.11 +# May you share freely, never taking more than you give.
1.12 +#
1.13 +#***********************************************************************
1.14 +# This file implements regression tests for SQLite library. The
1.15 +# focus of this script is a test of the DELETE command where a
1.16 +# large number of rows are deleted.
1.17 +#
1.18 +
1.19 +set testdir [file dirname $argv0]
1.20 +source $testdir/tester.tcl
1.21 +
1.22 +# Create a table that contains a large number of rows.
1.23 +#
1.24 +do_test delete3-1.1 {
1.25 + execsql {
1.26 + CREATE TABLE t1(x integer primary key);
1.27 + BEGIN;
1.28 + INSERT INTO t1 VALUES(1);
1.29 + INSERT INTO t1 VALUES(2);
1.30 + INSERT INTO t1 SELECT x+2 FROM t1;
1.31 + INSERT INTO t1 SELECT x+4 FROM t1;
1.32 + INSERT INTO t1 SELECT x+8 FROM t1;
1.33 + INSERT INTO t1 SELECT x+16 FROM t1;
1.34 + INSERT INTO t1 SELECT x+32 FROM t1;
1.35 + INSERT INTO t1 SELECT x+64 FROM t1;
1.36 + INSERT INTO t1 SELECT x+128 FROM t1;
1.37 + INSERT INTO t1 SELECT x+256 FROM t1;
1.38 + INSERT INTO t1 SELECT x+512 FROM t1;
1.39 + INSERT INTO t1 SELECT x+1024 FROM t1;
1.40 + INSERT INTO t1 SELECT x+2048 FROM t1;
1.41 + INSERT INTO t1 SELECT x+4096 FROM t1;
1.42 + INSERT INTO t1 SELECT x+8192 FROM t1;
1.43 + INSERT INTO t1 SELECT x+16384 FROM t1;
1.44 + INSERT INTO t1 SELECT x+32768 FROM t1;
1.45 + INSERT INTO t1 SELECT x+65536 FROM t1;
1.46 + INSERT INTO t1 SELECT x+131072 FROM t1;
1.47 + INSERT INTO t1 SELECT x+262144 FROM t1;
1.48 + COMMIT;
1.49 + SELECT count(*) FROM t1;
1.50 + }
1.51 +} {524288}
1.52 +do_test delete3-1.2 {
1.53 + execsql {
1.54 + DELETE FROM t1 WHERE x%2==0;
1.55 + SELECT count(*) FROM t1;
1.56 + }
1.57 +} {262144}
1.58 +integrity_check delete3-1.3
1.59 +
1.60 +finish_test