os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/trigger5.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/trigger5.test	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,43 @@
     1.4 +# The author disclaims copyright to this source code.  In place of
     1.5 +# a legal notice, here is a blessing:
     1.6 +#
     1.7 +#    May you do good and not evil.
     1.8 +#    May you find forgiveness for yourself and forgive others.
     1.9 +#    May you share freely, never taking more than you give.
    1.10 +#
    1.11 +#***********************************************************************
    1.12 +#
    1.13 +# This file tests the triggers of views.
    1.14 +#
    1.15 +
    1.16 +set testdir [file dirname $argv0]
    1.17 +source $testdir/tester.tcl
    1.18 +ifcapable {!trigger} {
    1.19 +  finish_test
    1.20 +  return
    1.21 +}
    1.22 +
    1.23 +# Ticket #844
    1.24 +#
    1.25 +do_test trigger5-1.1 {
    1.26 +  execsql {
    1.27 +    CREATE TABLE Item(
    1.28 +       a integer PRIMARY KEY NOT NULL ,
    1.29 +       b double NULL ,
    1.30 +       c int NOT NULL DEFAULT 0
    1.31 +    );
    1.32 +    CREATE TABLE Undo(UndoAction TEXT);
    1.33 +    INSERT INTO Item VALUES (1,38205.60865,340);
    1.34 +    CREATE TRIGGER trigItem_UNDO_AD AFTER DELETE ON Item FOR EACH ROW
    1.35 +    BEGIN
    1.36 +      INSERT INTO Undo SELECT 'INSERT INTO Item (a,b,c) VALUES ('
    1.37 +       || coalesce(old.a,'NULL') || ',' || quote(old.b) || ',' || old.c || ');';
    1.38 +    END;
    1.39 +    DELETE FROM Item WHERE a = 1;
    1.40 +    SELECT * FROM Undo;
    1.41 +  }
    1.42 +} {{INSERT INTO Item (a,b,c) VALUES (1,38205.60865,340);}}
    1.43 +
    1.44 +integrity_check trigger5-99.9
    1.45 +
    1.46 +finish_test