os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/delete3.test
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
# 2005 August 24
sl@0
     2
#
sl@0
     3
# The author disclaims copyright to this source code.  In place of
sl@0
     4
# a legal notice, here is a blessing:
sl@0
     5
#
sl@0
     6
#    May you do good and not evil.
sl@0
     7
#    May you find forgiveness for yourself and forgive others.
sl@0
     8
#    May you share freely, never taking more than you give.
sl@0
     9
#
sl@0
    10
#***********************************************************************
sl@0
    11
# This file implements regression tests for SQLite library.  The
sl@0
    12
# focus of this script is a test of the DELETE command where a
sl@0
    13
# large number of rows are deleted.
sl@0
    14
#
sl@0
    15
sl@0
    16
set testdir [file dirname $argv0]
sl@0
    17
source $testdir/tester.tcl
sl@0
    18
sl@0
    19
# Create a table that contains a large number of rows.
sl@0
    20
#
sl@0
    21
do_test delete3-1.1 {
sl@0
    22
  execsql {
sl@0
    23
    CREATE TABLE t1(x integer primary key);
sl@0
    24
    BEGIN;
sl@0
    25
    INSERT INTO t1 VALUES(1);
sl@0
    26
    INSERT INTO t1 VALUES(2);
sl@0
    27
    INSERT INTO t1 SELECT x+2 FROM t1;
sl@0
    28
    INSERT INTO t1 SELECT x+4 FROM t1;
sl@0
    29
    INSERT INTO t1 SELECT x+8 FROM t1;
sl@0
    30
    INSERT INTO t1 SELECT x+16 FROM t1;
sl@0
    31
    INSERT INTO t1 SELECT x+32 FROM t1;
sl@0
    32
    INSERT INTO t1 SELECT x+64 FROM t1;
sl@0
    33
    INSERT INTO t1 SELECT x+128 FROM t1;
sl@0
    34
    INSERT INTO t1 SELECT x+256 FROM t1;
sl@0
    35
    INSERT INTO t1 SELECT x+512 FROM t1;
sl@0
    36
    INSERT INTO t1 SELECT x+1024 FROM t1;
sl@0
    37
    INSERT INTO t1 SELECT x+2048 FROM t1;
sl@0
    38
    INSERT INTO t1 SELECT x+4096 FROM t1;
sl@0
    39
    INSERT INTO t1 SELECT x+8192 FROM t1;
sl@0
    40
    INSERT INTO t1 SELECT x+16384 FROM t1;
sl@0
    41
    INSERT INTO t1 SELECT x+32768 FROM t1;
sl@0
    42
    INSERT INTO t1 SELECT x+65536 FROM t1;
sl@0
    43
    INSERT INTO t1 SELECT x+131072 FROM t1;
sl@0
    44
    INSERT INTO t1 SELECT x+262144 FROM t1;
sl@0
    45
    COMMIT;
sl@0
    46
    SELECT count(*) FROM t1;	
sl@0
    47
  }
sl@0
    48
} {524288}
sl@0
    49
do_test delete3-1.2 {
sl@0
    50
  execsql {
sl@0
    51
    DELETE FROM t1 WHERE x%2==0;
sl@0
    52
    SELECT count(*) FROM t1;
sl@0
    53
  }
sl@0
    54
} {262144}
sl@0
    55
integrity_check delete3-1.3
sl@0
    56
sl@0
    57
finish_test