| OLD | NEW |
| (Empty) |
| 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 do_test tkt3992-2.1 { | |
| 48 execsql { | |
| 49 CREATE TABLE t1(a, b); | |
| 50 INSERT INTO t1 VALUES(1, 2); | |
| 51 ALTER TABLE t1 ADD COLUMN c DEFAULT 3; | |
| 52 SELECT * FROM t1; | |
| 53 } | |
| 54 } {1 2 3} | |
| 55 do_test tkt3992-2.2 { | |
| 56 execsql { | |
| 57 UPDATE t1 SET a = 'one'; | |
| 58 SELECT * FROM t1; | |
| 59 } | |
| 60 } {one 2 3} | |
| 61 | |
| 62 db function tcl eval | |
| 63 do_test tkt3992-2.3 { | |
| 64 execsql { | |
| 65 CREATE TABLE t2(a REAL, b REAL, c REAL); | |
| 66 INSERT INTO t2 VALUES(1, 2, 3); | |
| 67 CREATE TRIGGER tr2 BEFORE UPDATE ON t2 BEGIN | |
| 68 SELECT tcl('set res', typeof(new.c)); | |
| 69 END; | |
| 70 | |
| 71 UPDATE t2 SET a = 'I'; | |
| 72 } | |
| 73 set res | |
| 74 } {real} | |
| 75 | |
| 76 | |
| 77 finish_test | |
| OLD | NEW |