os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/tkt2832.test
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/tkt2832.test	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,65 @@
     1.4 +# 2007 Dec 12
     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 +#
    1.15 +# This file is to test that ticket #2832 has been fixed.
    1.16 +#
    1.17 +# $Id: tkt2832.test,v 1.4 2008/07/12 14:52:21 drh Exp $
    1.18 +#
    1.19 +
    1.20 +set testdir [file dirname $argv0]
    1.21 +source $testdir/tester.tcl
    1.22 +
    1.23 +do_test tkt2832-1.1 {
    1.24 +  execsql {
    1.25 +    CREATE TABLE t1(a PRIMARY KEY);
    1.26 +    INSERT INTO t1 VALUES(2);
    1.27 +    INSERT INTO t1 VALUES(1);
    1.28 +    INSERT INTO t1 VALUES(3);
    1.29 +  }
    1.30 +} {}
    1.31 +do_test tkt2832-1.2 {
    1.32 +  execsql {
    1.33 +    UPDATE OR REPLACE t1 SET a = 1;
    1.34 +    SELECT * FROM t1;
    1.35 +  }
    1.36 +} {1}
    1.37 +
    1.38 +do_test tkt2832-2.1 {
    1.39 +  execsql {
    1.40 +    CREATE TABLE t2(a, b);
    1.41 +    CREATE TRIGGER t2_t AFTER UPDATE ON t2 BEGIN
    1.42 +      DELETE FROM t2 WHERE a = new.a + 1;
    1.43 +    END;
    1.44 +    INSERT INTO t2 VALUES(1, 2);
    1.45 +    INSERT INTO t2 VALUES(2, 3);
    1.46 +  }
    1.47 +} {}
    1.48 +do_test tkt2832-2.2 {
    1.49 +  execsql { 
    1.50 +    UPDATE t2 SET b = 5 
    1.51 +  }
    1.52 +} {}
    1.53 +
    1.54 +do_test tkt2832-3.1 {
    1.55 +  execsql {
    1.56 +    CREATE TABLE t3(a, b);
    1.57 +    CREATE TRIGGER t3_t AFTER DELETE ON t3 BEGIN
    1.58 +      DELETE FROM t3 WHERE a = old.a + 1;
    1.59 +    END;
    1.60 +    INSERT INTO t3 VALUES(1, 2);
    1.61 +    INSERT INTO t3 VALUES(2, 3);
    1.62 +  }
    1.63 +} {}
    1.64 +do_test tkt2832-3.2 {
    1.65 +  execsql { DELETE FROM t3 WHERE 1 }
    1.66 +} {}
    1.67 +
    1.68 +finish_test