diff options
Diffstat (limited to 'third_party/sqlite/test/hook.test')
-rw-r--r-- | third_party/sqlite/test/hook.test | 60 |
1 files changed, 40 insertions, 20 deletions
diff --git a/third_party/sqlite/test/hook.test b/third_party/sqlite/test/hook.test index 39892b3..b526708 100644 --- a/third_party/sqlite/test/hook.test +++ b/third_party/sqlite/test/hook.test @@ -17,7 +17,7 @@ # sqlite_update_hook (tests hook-4-*) # sqlite_rollback_hook (tests hook-5.*) # -# $Id: hook.test,v 1.13 2008/01/19 20:11:26 drh Exp $ +# $Id: hook.test,v 1.15 2009/04/07 14:14:23 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -92,6 +92,27 @@ do_test hook-3.9 { set ::commit_cnt } {} +# Ticket #3564. +# +do_test hook-3.10 { + file delete -force test2.db test2.db-journal + sqlite3 db2 test2.db + proc commit_hook {} { + set y [db2 one {SELECT y FROM t3 WHERE y>10}] + return [expr {$y>10}] + } + db2 eval {CREATE TABLE t3(x,y)} + db2 commit_hook commit_hook + catchsql {INSERT INTO t3 VALUES(1,2)} db2 + catchsql {INSERT INTO t3 VALUES(11,12)} db2 + catchsql {INSERT INTO t3 VALUES(3,4)} db2 + db2 eval { + SELECT * FROM t3 ORDER BY x; + } +} {1 2 3 4} +db2 close + + #---------------------------------------------------------------------------- # Tests for the update-hook. # @@ -137,26 +158,25 @@ do_test hook-4.1.2 { DELETE main t1 4 \ ] -# Update hook is not invoked for changes to sqlite_master -# -do_test hook-4.1.3 { - set ::update_hook {} - execsql { - CREATE TRIGGER r1 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END; - } - set ::update_hook -} {} -do_test hook-4.1.4 { - set ::update_hook {} - execsql { - DROP TRIGGER r1; - } - set ::update_hook -} {} - - -set ::update_hook {} ifcapable trigger { + # Update hook is not invoked for changes to sqlite_master + # + do_test hook-4.1.3 { + set ::update_hook {} + execsql { + CREATE TRIGGER r1 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END; + } + set ::update_hook + } {} + do_test hook-4.1.4 { + set ::update_hook {} + execsql { + DROP TRIGGER r1; + } + set ::update_hook + } {} + + set ::update_hook {} do_test hook-4.2.1 { catchsql { DROP TABLE t2; |