CoolFace
Modelpublic

AryaWu/sqlite

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
tkt2832.test68 linesDownload Raw Back to test
1# 2007 Dec 122#3# The author disclaims copyright to this source code. In place of4# 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.5 2009/04/07 14:14:23 danielk1977 Exp $15#16 17set testdir [file dirname $argv0]18source $testdir/tester.tcl19 20ifcapable !trigger { finish_test ; return }21 22do_test tkt2832-1.1 {23  execsql {24    CREATE TABLE t1(a PRIMARY KEY);25    INSERT INTO t1 VALUES(2);26    INSERT INTO t1 VALUES(1);27    INSERT INTO t1 VALUES(3);28  }29} {}30do_test tkt2832-1.2 {31  execsql {32    UPDATE OR REPLACE t1 SET a = 1;33    SELECT * FROM t1;34  }35} {1}36 37do_test tkt2832-2.1 {38  execsql {39    CREATE TABLE t2(a, b);40    CREATE TRIGGER t2_t AFTER UPDATE ON t2 BEGIN41      DELETE FROM t2 WHERE a = new.a + 1;42    END;43    INSERT INTO t2 VALUES(1, 2);44    INSERT INTO t2 VALUES(2, 3);45  }46} {}47do_test tkt2832-2.2 {48  execsql { 49    UPDATE t2 SET b = 5 50  }51} {}52 53do_test tkt2832-3.1 {54  execsql {55    CREATE TABLE t3(a, b);56    CREATE TRIGGER t3_t AFTER DELETE ON t3 BEGIN57      DELETE FROM t3 WHERE a = old.a + 1;58    END;59    INSERT INTO t3 VALUES(1, 2);60    INSERT INTO t3 VALUES(2, 3);61  }62} {}63do_test tkt2832-3.2 {64  execsql { DELETE FROM t3 WHERE 1 }65} {}66 67finish_test68