sl@0: # The author disclaims copyright to this source code. In place of sl@0: # a legal notice, here is a blessing: sl@0: # sl@0: # May you do good and not evil. sl@0: # May you find forgiveness for yourself and forgive others. sl@0: # May you share freely, never taking more than you give. sl@0: # sl@0: #*********************************************************************** sl@0: # sl@0: # This file tests the triggers of views. sl@0: # sl@0: sl@0: set testdir [file dirname $argv0] sl@0: source $testdir/tester.tcl sl@0: ifcapable {!trigger} { sl@0: finish_test sl@0: return sl@0: } sl@0: sl@0: # Ticket #844 sl@0: # sl@0: do_test trigger5-1.1 { sl@0: execsql { sl@0: CREATE TABLE Item( sl@0: a integer PRIMARY KEY NOT NULL , sl@0: b double NULL , sl@0: c int NOT NULL DEFAULT 0 sl@0: ); sl@0: CREATE TABLE Undo(UndoAction TEXT); sl@0: INSERT INTO Item VALUES (1,38205.60865,340); sl@0: CREATE TRIGGER trigItem_UNDO_AD AFTER DELETE ON Item FOR EACH ROW sl@0: BEGIN sl@0: INSERT INTO Undo SELECT 'INSERT INTO Item (a,b,c) VALUES (' sl@0: || coalesce(old.a,'NULL') || ',' || quote(old.b) || ',' || old.c || ');'; sl@0: END; sl@0: DELETE FROM Item WHERE a = 1; sl@0: SELECT * FROM Undo; sl@0: } sl@0: } {{INSERT INTO Item (a,b,c) VALUES (1,38205.60865,340);}} sl@0: sl@0: integrity_check trigger5-99.9 sl@0: sl@0: finish_test