sl@0: # 2007 Dec 12 sl@0: # 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 is to test that ticket #2832 has been fixed. sl@0: # sl@0: # $Id: tkt2832.test,v 1.4 2008/07/12 14:52:21 drh Exp $ sl@0: # sl@0: sl@0: set testdir [file dirname $argv0] sl@0: source $testdir/tester.tcl sl@0: sl@0: do_test tkt2832-1.1 { sl@0: execsql { sl@0: CREATE TABLE t1(a PRIMARY KEY); sl@0: INSERT INTO t1 VALUES(2); sl@0: INSERT INTO t1 VALUES(1); sl@0: INSERT INTO t1 VALUES(3); sl@0: } sl@0: } {} sl@0: do_test tkt2832-1.2 { sl@0: execsql { sl@0: UPDATE OR REPLACE t1 SET a = 1; sl@0: SELECT * FROM t1; sl@0: } sl@0: } {1} sl@0: sl@0: do_test tkt2832-2.1 { sl@0: execsql { sl@0: CREATE TABLE t2(a, b); sl@0: CREATE TRIGGER t2_t AFTER UPDATE ON t2 BEGIN sl@0: DELETE FROM t2 WHERE a = new.a + 1; sl@0: END; sl@0: INSERT INTO t2 VALUES(1, 2); sl@0: INSERT INTO t2 VALUES(2, 3); sl@0: } sl@0: } {} sl@0: do_test tkt2832-2.2 { sl@0: execsql { sl@0: UPDATE t2 SET b = 5 sl@0: } sl@0: } {} sl@0: sl@0: do_test tkt2832-3.1 { sl@0: execsql { sl@0: CREATE TABLE t3(a, b); sl@0: CREATE TRIGGER t3_t AFTER DELETE ON t3 BEGIN sl@0: DELETE FROM t3 WHERE a = old.a + 1; sl@0: END; sl@0: INSERT INTO t3 VALUES(1, 2); sl@0: INSERT INTO t3 VALUES(2, 3); sl@0: } sl@0: } {} sl@0: do_test tkt2832-3.2 { sl@0: execsql { DELETE FROM t3 WHERE 1 } sl@0: } {} sl@0: sl@0: finish_test