persistentstorage/sqlite3api/TEST/TclScript/delete3.test
changeset 0 08ec8eefde2f
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 # 2005 August 24
       
     2 #
       
     3 # The author disclaims copyright to this source code.  In place of
       
     4 # a legal notice, here is a blessing:
       
     5 #
       
     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.
       
     9 #
       
    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.
       
    14 #
       
    15 
       
    16 set testdir [file dirname $argv0]
       
    17 source $testdir/tester.tcl
       
    18 
       
    19 # Create a table that contains a large number of rows.
       
    20 #
       
    21 do_test delete3-1.1 {
       
    22   execsql {
       
    23     CREATE TABLE t1(x integer primary key);
       
    24     BEGIN;
       
    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;
       
    45     COMMIT;
       
    46     SELECT count(*) FROM t1;	
       
    47   }
       
    48 } {524288}
       
    49 do_test delete3-1.2 {
       
    50   execsql {
       
    51     DELETE FROM t1 WHERE x%2==0;
       
    52     SELECT count(*) FROM t1;
       
    53   }
       
    54 } {262144}
       
    55 integrity_check delete3-1.3
       
    56 
       
    57 finish_test