1 # 2001 September 15 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 # 12 # $Id: tkt3992.test,v 1.1 2009/07/27 10:05:06 danielk1977 Exp $ 13 14 set testdir [file dirname $argv0] 15 source $testdir/tester.tcl 16 17 do_test tkt3992-1.1 { 18 execsql { 19 CREATE TABLE parameters1( 20 mountcnt INT NOT NULL CHECK (typeof(mountcnt) == 'integer'), 21 version REAL NOT NULL 22 ); 23 INSERT INTO parameters1(mountcnt, version) VALUES(1, 1.0); 24 25 CREATE TABLE parameters2( 26 mountcnt INT NOT NULL CHECK (typeof(mountcnt) == 'integer'), 27 version REAL CHECK (typeof(version) == 'real') 28 ); 29 INSERT INTO parameters2(mountcnt, version) VALUES(1, 1.0); 30 } 31 } {} 32 33 do_test tkt3992-1.2 { 34 execsql { 35 UPDATE parameters1 SET mountcnt = mountcnt + 1; 36 SELECT * FROM parameters1; 37 } 38 } {2 1.0} 39 40 do_test tkt3992-1.3 { 41 execsql { 42 UPDATE parameters2 SET mountcnt = mountcnt + 1; 43 SELECT * FROM parameters2; 44 } 45 } {2 1.0} 46 47 ifcapable altertable { 48 do_test tkt3992-2.1 { 49 execsql { 50 CREATE TABLE t1(a, b); 51 INSERT INTO t1 VALUES(1, 2); 52 ALTER TABLE t1 ADD COLUMN c DEFAULT 3; 53 SELECT * FROM t1; 54 } 55 } {1 2 3} 56 do_test tkt3992-2.2 { 57 execsql { 58 UPDATE t1 SET a = 'one'; 59 SELECT * FROM t1; 60 } 61 } {one 2 3} 62 } 63 64 ifcapable trigger { 65 db function tcl eval 66 do_test tkt3992-2.3 { 67 execsql { 68 CREATE TABLE t2(a REAL, b REAL, c REAL); 69 INSERT INTO t2 VALUES(1, 2, 3); 70 CREATE TRIGGER tr2 BEFORE UPDATE ON t2 BEGIN 71 SELECT tcl('set res', typeof(new.c)); 72 END; 73 74 UPDATE t2 SET a = 'I'; 75 } 76 set res 77 } {real} 78 } 79 80 81 finish_test 82