Index: test/collate6.test ================================================================== --- test/collate6.test +++ test/collate6.test @@ -10,11 +10,11 @@ # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is collation sequences in concert with triggers. # -# $Id: collate6.test,v 1.2 2004/11/04 04:42:28 drh Exp $ +# $Id: collate6.test,v 1.3 2007/07/26 10:16:30 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # There are no tests in this file that will work without @@ -104,8 +104,37 @@ do_test collate6-1.9 { execsql { DROP TABLE collate6tab; } } {} + +# Test that an explicit collation sequence overrides an implicit +# one attached to a 'new' reference. +# +do_test collate6-2.1 { + execsql { + CREATE TABLE abc(a COLLATE binary, b, c); + CREATE TABLE def(a, b, c); + CREATE TRIGGER abc_t1 AFTER INSERT ON abc BEGIN + INSERT INTO def SELECT * FROM abc WHERE a < new.a COLLATE nocase; + END + } +} {} +do_test collate6-2.2 { + execsql { + INSERT INTO abc VALUES('One', 'Two', 'Three'); + INSERT INTO abc VALUES('one', 'two', 'three'); + SELECT * FROM def; + } +} {} +do_test collate6-2.3 { + execsql { + UPDATE abc SET a = 'four' WHERE a = 'one'; + CREATE TRIGGER abc_t2 AFTER UPDATE ON abc BEGIN + INSERT INTO def SELECT * FROM abc WHERE a < new.a COLLATE nocase; + END; + SELECT * FROM def; + } +} {} finish_test