3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #*************************************************************************
13 set testdir [file dirname $argv0]
15 source $testdir/tester.tcl
17 # If SQLITE_OMIT_ALTERTABLE is defined, omit this file.
18 ifcapable !altertable {
22 set testprefix alterauth2
25 proc xAuth {type args} {
26 lappend ::auth [concat $type [lrange $args 0 3]]
27 if {$type=="SQLITE_READ" && [lindex $args 0] == "t2"} breakpoint
32 proc do_auth_test {tn sql authcode} {
36 lsort -unique \[set ::auth\]
39 set normal [list {*}$authcode]
40 uplevel [list do_test $tn $script $normal]
44 CREATE TABLE t1(a, b, c);
45 CREATE VIEW v1 AS SELECT * FROM t1;
46 CREATE TRIGGER tr1 AFTER INSERT ON t1 BEGIN
47 DELETE FROM t1 WHERE a<new.a;
50 CREATE TEMP TRIGGER tr2 AFTER UPDATE OF a, b ON t1 BEGIN
51 UPDATE t1 SET a=a+1 WHERE new.b<b;
56 ALTER TABLE t1 RENAME TO t2;
58 {SQLITE_ALTER_TABLE main t1 {} {}}
59 {SQLITE_FUNCTION {} like {} {}}
60 {SQLITE_FUNCTION {} sqlite_rename_table {} {}}
61 {SQLITE_FUNCTION {} sqlite_rename_test {} {}}
62 {SQLITE_FUNCTION {} substr {} {}}
63 {SQLITE_READ sqlite_master name main {}}
64 {SQLITE_READ sqlite_master sql main {}}
65 {SQLITE_READ sqlite_master tbl_name main {}}
66 {SQLITE_READ sqlite_master type main {}}
67 {SQLITE_READ sqlite_temp_master name temp {}}
68 {SQLITE_READ sqlite_temp_master sql temp {}}
69 {SQLITE_READ sqlite_temp_master tbl_name temp {}}
70 {SQLITE_READ sqlite_temp_master type temp {}}
71 {SQLITE_SELECT {} {} {} {}}
72 {SQLITE_UPDATE sqlite_master name main {}}
73 {SQLITE_UPDATE sqlite_master sql main {}}
74 {SQLITE_UPDATE sqlite_master tbl_name main {}}
75 {SQLITE_UPDATE sqlite_temp_master sql temp {}}
76 {SQLITE_UPDATE sqlite_temp_master tbl_name temp {}}
80 ALTER TABLE t2 RENAME a TO aaa;
82 {SQLITE_ALTER_TABLE main t2 {} {}}
83 {SQLITE_FUNCTION {} like {} {}}
84 {SQLITE_FUNCTION {} sqlite_rename_column {} {}}
85 {SQLITE_FUNCTION {} sqlite_rename_test {} {}}
86 {SQLITE_READ sqlite_master name main {}}
87 {SQLITE_READ sqlite_master sql main {}}
88 {SQLITE_READ sqlite_master tbl_name main {}}
89 {SQLITE_READ sqlite_master type main {}}
90 {SQLITE_READ sqlite_temp_master name temp {}}
91 {SQLITE_READ sqlite_temp_master sql temp {}}
92 {SQLITE_READ sqlite_temp_master type temp {}}
93 {SQLITE_SELECT {} {} {} {}}
94 {SQLITE_UPDATE sqlite_master sql main {}}
95 {SQLITE_UPDATE sqlite_temp_master sql temp {}}