Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sqlite/blob/master/test/alterauth2.test # sqlite [Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `sqlite / test / alterauth2.test` 170 lines ยท 5379 bytes Raw Blame History 1 # 2018 October 6 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 13 set testdir [file dirname $argv0] 14 15 source $testdir/tester.tcl 16 17 # If SQLITE_OMIT_ALTERTABLE is defined, omit this file. 18 ifcapable !altertable { 19 finish_test 20 return 21 } 22 set testprefix alterauth2 23 24 set ::auth [list] 25 proc xAuth {type args} { 26 lappend ::auth [concat $type [lrange $args 0 3]] 27 if {$type=="SQLITE_READ" && [lindex $args 0] == "t2"} breakpoint 28 return SQLITE_OK 29 } 30 db auth xAuth 31 32 proc do_auth_test {tn sql authcode} { 33 set script " 34 set ::auth \[list\] 35 execsql {$sql} 36 lsort -unique \[set ::auth\] 37 " 38 39 set normal [list {*}$authcode] 40 uplevel [list do_test $tn $script $normal] 41 } 42 43 do_execsql_test 1.0 { 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 ab) 146 } { 147 {SQLITE_ALTER_TABLE main t2 {} {}} 148 {SQLITE_FUNCTION {} sqlite_add_constraint {} {}} 149 {SQLITE_FUNCTION {} sqlite_fail {} {}} 150 {SQLITE_FUNCTION {} sqlite_find_constraint {} {}} 151 {SQLITE_READ sqlite_master sql main {}} 152 {SQLITE_READ sqlite_master tbl_name main {}} 153 {SQLITE_READ sqlite_master type main {}} 154 {SQLITE_READ t2 aaa main {}} 155 {SQLITE_READ t2 b main {}} 156 {SQLITE_SELECT {} {} {} {}} 157 {SQLITE_UPDATE sqlite_master sql main {}} 158 } 159 do_auth_test 1.7 { 160 ALTER TABLE t2 DROP CONSTRAINT abc; 161 } { 162 {SQLITE_ALTER_TABLE main t2 {} {}} 163 {SQLITE_FUNCTION {} sqlite_drop_constraint {} {}} 164 {SQLITE_READ sqlite_master sql main {}} 165 {SQLITE_READ sqlite_master tbl_name main {}} 166 {SQLITE_READ sqlite_master type main {}} 167 {SQLITE_UPDATE sqlite_master sql main {}} 168 } 169 170 finish_test