persistentstorage/sqlite3api/TEST/TclScript/tkt2832.test
changeset 0 08ec8eefde2f
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 # 2007 Dec 12
       
     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 #
       
    12 # This file is to test that ticket #2832 has been fixed.
       
    13 #
       
    14 # $Id: tkt2832.test,v 1.4 2008/07/12 14:52:21 drh Exp $
       
    15 #
       
    16 
       
    17 set testdir [file dirname $argv0]
       
    18 source $testdir/tester.tcl
       
    19 
       
    20 do_test tkt2832-1.1 {
       
    21   execsql {
       
    22     CREATE TABLE t1(a PRIMARY KEY);
       
    23     INSERT INTO t1 VALUES(2);
       
    24     INSERT INTO t1 VALUES(1);
       
    25     INSERT INTO t1 VALUES(3);
       
    26   }
       
    27 } {}
       
    28 do_test tkt2832-1.2 {
       
    29   execsql {
       
    30     UPDATE OR REPLACE t1 SET a = 1;
       
    31     SELECT * FROM t1;
       
    32   }
       
    33 } {1}
       
    34 
       
    35 do_test tkt2832-2.1 {
       
    36   execsql {
       
    37     CREATE TABLE t2(a, b);
       
    38     CREATE TRIGGER t2_t AFTER UPDATE ON t2 BEGIN
       
    39       DELETE FROM t2 WHERE a = new.a + 1;
       
    40     END;
       
    41     INSERT INTO t2 VALUES(1, 2);
       
    42     INSERT INTO t2 VALUES(2, 3);
       
    43   }
       
    44 } {}
       
    45 do_test tkt2832-2.2 {
       
    46   execsql { 
       
    47     UPDATE t2 SET b = 5 
       
    48   }
       
    49 } {}
       
    50 
       
    51 do_test tkt2832-3.1 {
       
    52   execsql {
       
    53     CREATE TABLE t3(a, b);
       
    54     CREATE TRIGGER t3_t AFTER DELETE ON t3 BEGIN
       
    55       DELETE FROM t3 WHERE a = old.a + 1;
       
    56     END;
       
    57     INSERT INTO t3 VALUES(1, 2);
       
    58     INSERT INTO t3 VALUES(2, 3);
       
    59   }
       
    60 } {}
       
    61 do_test tkt2832-3.2 {
       
    62   execsql { DELETE FROM t3 WHERE 1 }
       
    63 } {}
       
    64 
       
    65 finish_test