3
# The author disclaims copyright to this source code. In place of
4
# a legal notice, here is a blessing:
6
# May you do good and not evil.
7
# May you find forgiveness for yourself and forgive others.
8
# May you share freely, never taking more than you give.
10
#***********************************************************************
11
# This file implements regression tests for SQLite library. The
12
# focus of this script is a test of the DELETE command where a
13
# large number of rows are deleted.
16
set testdir [file dirname $argv0]
17
source $testdir/tester.tcl
19
# Create a table that contains a large number of rows.
23
CREATE TABLE t1(x integer primary key);
25
INSERT INTO t1 VALUES(1);
26
INSERT INTO t1 VALUES(2);
27
INSERT INTO t1 SELECT x+2 FROM t1;
28
INSERT INTO t1 SELECT x+4 FROM t1;
29
INSERT INTO t1 SELECT x+8 FROM t1;
30
INSERT INTO t1 SELECT x+16 FROM t1;
31
INSERT INTO t1 SELECT x+32 FROM t1;
32
INSERT INTO t1 SELECT x+64 FROM t1;
33
INSERT INTO t1 SELECT x+128 FROM t1;
34
INSERT INTO t1 SELECT x+256 FROM t1;
35
INSERT INTO t1 SELECT x+512 FROM t1;
36
INSERT INTO t1 SELECT x+1024 FROM t1;
37
INSERT INTO t1 SELECT x+2048 FROM t1;
38
INSERT INTO t1 SELECT x+4096 FROM t1;
39
INSERT INTO t1 SELECT x+8192 FROM t1;
40
INSERT INTO t1 SELECT x+16384 FROM t1;
41
INSERT INTO t1 SELECT x+32768 FROM t1;
42
INSERT INTO t1 SELECT x+65536 FROM t1;
43
INSERT INTO t1 SELECT x+131072 FROM t1;
44
INSERT INTO t1 SELECT x+262144 FROM t1;
46
SELECT count(*) FROM t1;
51
DELETE FROM t1 WHERE x%2==0;
52
SELECT count(*) FROM t1;
55
integrity_check delete3-1.3