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 alterauth
25 proc xAuth {type args} {
26 if {$type == "SQLITE_ALTER_TABLE"} {
27 lappend ::auth [concat $type [lrange $args 0 3]]
33 do_execsql_test 1.0 { CREATE TABLE t1(a, b, c); }
37 execsql { ALTER TABLE t1 RENAME TO t2 }
39 } {{SQLITE_ALTER_TABLE main t1 {} {}}}
43 execsql { ALTER TABLE t2 RENAME c TO ccc }
45 } {{SQLITE_ALTER_TABLE main t2 {} {}}}
49 execsql { ALTER TABLE t2 ADD COLUMN d }
51 } {{SQLITE_ALTER_TABLE main t2 {} {}}}
53 proc xAuth {type args} {
54 if {$type == "SQLITE_ALTER_TABLE"} {
61 catchsql { ALTER TABLE t2 RENAME TO t3 }
62 } {1 {not authorized}}
65 catchsql { ALTER TABLE t2 RENAME d TO ddd }
66 } {1 {not authorized}}
69 catchsql { ALTER TABLE t2 ADD COLUMN e }
70 } {1 {not authorized}}