blob: ac40c5806ef9c94e57952839a5a03e097ec062b2 [file] [log] [blame]
drh8ce10ba2003-06-22 01:41:49 +00001# 2003 June 21
2#
3# The author disclaims copyright to this source code. In place of
4# 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# This file implements regression tests for SQLite library.
12#
13# This file implements tests for miscellanous features that were
14# left out of other test files.
15#
drhd60ccc62003-06-24 10:39:46 +000016# $Id: misc2.test,v 1.2 2003/06/24 10:39:46 drh Exp $
drh8ce10ba2003-06-22 01:41:49 +000017
18set testdir [file dirname $argv0]
19source $testdir/tester.tcl
20
21# Test for ticket #360
22#
23do_test misc2-1.1 {
24 catchsql {
25 CREATE TABLE FOO(bar integer);
26 CREATE TRIGGER foo_insert BEFORE INSERT ON foo BEGIN
27 SELECT CASE WHEN (NOT new.bar BETWEEN 0 AND 20)
28 THEN raise(rollback, 'aiieee') END;
29 END;
30 INSERT INTO foo(bar) VALUES (1);
31 }
32} {1 aiieee}
drhd60ccc62003-06-24 10:39:46 +000033
34# Make sure ROWID works on a view and a subquery. Ticket #364
35#
36do_test misc2-2.1 {
37 execsql {
38 CREATE TABLE t1(a,b,c);
39 INSERT INTO t1 VALUES(1,2,3);
40 CREATE TABLE t2(x,y,z);
41 INSERT INTO t2 VALUES(7,8,9);
42 SELECT rowid, * FROM (SELECT * FROM t1, t2);
43 }
44} {{} 1 2 3 7 8 9}
45do_test misc2-2.2 {
46 execsql {
47 CREATE VIEW v1 AS SELECT * FROM t1, t2;
48 SELECT rowid, * FROM v1;
49 }
50} {{} 1 2 3 7 8 9}