auth.test revision 2
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A# 2003 April 4
2N/A#
2N/A# The author disclaims copyright to this source code. In place of
2N/A# a legal notice, here is a blessing:
2N/A#
2N/A# May you do good and not evil.
2N/A# May you find forgiveness for yourself and forgive others.
2N/A# May you share freely, never taking more than you give.
2N/A#
2N/A#***********************************************************************
2N/A# This file implements regression tests for SQLite library. The
2N/A# focus of this script is testing the ATTACH and DETACH commands
2N/A# and related functionality.
2N/A#
2N/A# $Id: auth.test,v 1.12 2003/12/07 00:24:35 drh Exp $
2N/A#
2N/A
2N/Aset testdir [file dirname $argv0]
2N/Asource $testdir/tester.tcl
2N/A
2N/A# disable this test if the SQLITE_OMIT_AUTHORIZATION macro is
2N/A# defined during compilation.
2N/A
2N/Ado_test auth-1.1.1 {
2N/A db close
2N/A set ::DB [sqlite db test.db]
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_INSERT" && $arg1=="sqlite_master"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A db authorizer ::auth
2N/A catchsql {CREATE TABLE t1(a,b,c)}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.1.2 {
2N/A db errorcode
2N/A} {23}
2N/Ado_test auth-1.2 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {}
2N/Ado_test auth-1.3.1 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_TABLE"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE TABLE t1(a,b,c)}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.3.2 {
2N/A db errorcode
2N/A} {23}
2N/Ado_test auth-1.3.3 {
2N/A set ::authargs
2N/A} {t1 {} main {}}
2N/Ado_test auth-1.4 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {}
2N/A
2N/Ado_test auth-1.5 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_INSERT" && $arg1=="sqlite_temp_master"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE TEMP TABLE t1(a,b,c)}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.6 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {}
2N/Ado_test auth-1.7.1 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_TEMP_TABLE"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE TEMP TABLE t1(a,b,c)}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.7.2 {
2N/A set ::authargs
2N/A} {t1 {} temp {}}
2N/Ado_test auth-1.8 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {}
2N/A
2N/Ado_test auth-1.9 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_INSERT" && $arg1=="sqlite_master"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE TABLE t1(a,b,c)}
2N/A} {0 {}}
2N/Ado_test auth-1.10 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {}
2N/Ado_test auth-1.11 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_TABLE"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE TABLE t1(a,b,c)}
2N/A} {0 {}}
2N/Ado_test auth-1.12 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {}
2N/Ado_test auth-1.13 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_INSERT" && $arg1=="sqlite_temp_master"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE TEMP TABLE t1(a,b,c)}
2N/A} {0 {}}
2N/Ado_test auth-1.14 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {}
2N/Ado_test auth-1.15 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_TEMP_TABLE"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE TEMP TABLE t1(a,b,c)}
2N/A} {0 {}}
2N/Ado_test auth-1.16 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {}
2N/A
2N/Ado_test auth-1.17 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_TABLE"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE TEMP TABLE t1(a,b,c)}
2N/A} {0 {}}
2N/Ado_test auth-1.18 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/Ado_test auth-1.19.1 {
2N/A set ::authargs {}
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_TEMP_TABLE"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE TABLE t2(a,b,c)}
2N/A} {0 {}}
2N/Ado_test auth-1.19.2 {
2N/A set ::authargs
2N/A} {}
2N/Ado_test auth-1.20 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2}
2N/A
2N/Ado_test auth-1.21.1 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_TABLE"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TABLE t2}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.21.2 {
2N/A set ::authargs
2N/A} {t2 {} main {}}
2N/Ado_test auth-1.22 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2}
2N/Ado_test auth-1.23.1 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_TABLE"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TABLE t2}
2N/A} {0 {}}
2N/Ado_test auth-1.23.2 {
2N/A set ::authargs
2N/A} {t2 {} main {}}
2N/Ado_test auth-1.24 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2}
2N/A
2N/Ado_test auth-1.25 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_TEMP_TABLE"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TABLE t1}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.26 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/Ado_test auth-1.27 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_TEMP_TABLE"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TABLE t1}
2N/A} {0 {}}
2N/Ado_test auth-1.28 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/A
2N/Ado_test auth-1.29 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_INSERT" && $arg1=="t2"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {INSERT INTO t2 VALUES(1,2,3)}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.30 {
2N/A execsql {SELECT * FROM t2}
2N/A} {}
2N/Ado_test auth-1.31 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_INSERT" && $arg1=="t2"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {INSERT INTO t2 VALUES(1,2,3)}
2N/A} {0 {}}
2N/Ado_test auth-1.32 {
2N/A execsql {SELECT * FROM t2}
2N/A} {}
2N/Ado_test auth-1.33 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_INSERT" && $arg1=="t1"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {INSERT INTO t2 VALUES(1,2,3)}
2N/A} {0 {}}
2N/Ado_test auth-1.34 {
2N/A execsql {SELECT * FROM t2}
2N/A} {1 2 3}
2N/A
2N/Ado_test auth-1.35.1 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="b"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {SELECT * FROM t2}
2N/A} {1 {access to t2.b is prohibited}}
2N/Ado_test auth-1.35.2 {
2N/A execsql {ATTACH DATABASE 'test.db' AS two}
2N/A catchsql {SELECT * FROM two.t2}
2N/A} {1 {access to two.t2.b is prohibited}}
2N/Aexecsql {DETACH DATABASE two}
2N/Ado_test auth-1.36 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="b"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {SELECT * FROM t2}
2N/A} {0 {1 {} 3}}
2N/Ado_test auth-1.37 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="b"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {SELECT * FROM t2 WHERE b=2}
2N/A} {0 {}}
2N/Ado_test auth-1.38 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="a"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {SELECT * FROM t2 WHERE b=2}
2N/A} {0 {{} 2 3}}
2N/Ado_test auth-1.39 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="b"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {SELECT * FROM t2 WHERE b IS NULL}
2N/A} {0 {1 {} 3}}
2N/Ado_test auth-1.40 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="b"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {SELECT a,c FROM t2 WHERE b IS NULL}
2N/A} {1 {access to t2.b is prohibited}}
2N/A
2N/Ado_test auth-1.41 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_UPDATE" && $arg1=="t2" && $arg2=="b"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {UPDATE t2 SET a=11}
2N/A} {0 {}}
2N/Ado_test auth-1.42 {
2N/A execsql {SELECT * FROM t2}
2N/A} {11 2 3}
2N/Ado_test auth-1.43 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_UPDATE" && $arg1=="t2" && $arg2=="b"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {UPDATE t2 SET b=22, c=33}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.44 {
2N/A execsql {SELECT * FROM t2}
2N/A} {11 2 3}
2N/Ado_test auth-1.45 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_UPDATE" && $arg1=="t2" && $arg2=="b"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {UPDATE t2 SET b=22, c=33}
2N/A} {0 {}}
2N/Ado_test auth-1.46 {
2N/A execsql {SELECT * FROM t2}
2N/A} {11 2 33}
2N/A
2N/Ado_test auth-1.47 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="t2"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DELETE FROM t2 WHERE a=11}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.48 {
2N/A execsql {SELECT * FROM t2}
2N/A} {11 2 33}
2N/Ado_test auth-1.49 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="t2"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DELETE FROM t2 WHERE a=11}
2N/A} {0 {}}
2N/Ado_test auth-1.50 {
2N/A execsql {SELECT * FROM t2}
2N/A} {11 2 33}
2N/A
2N/Ado_test auth-1.51 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_SELECT"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {SELECT * FROM t2}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.52 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_SELECT"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {SELECT * FROM t2}
2N/A} {0 {}}
2N/Ado_test auth-1.53 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_SELECT"} {
2N/A return SQLITE_OK
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {SELECT * FROM t2}
2N/A} {0 {11 2 33}}
2N/A
2N/Aset f [open data1.txt w]
2N/Aputs $f "7:8:9"
2N/Aclose $f
2N/Ado_test auth-1.54 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_COPY"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {COPY t2 FROM 'data1.txt' USING DELIMITERS ':'}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.55 {
2N/A set ::authargs
2N/A} {t2 data1.txt main {}}
2N/Ado_test auth-1.56 {
2N/A execsql {SELECT * FROM t2}
2N/A} {11 2 33}
2N/Ado_test auth-1.57 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_COPY"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {COPY t2 FROM 'data1.txt' USING DELIMITERS ':'}
2N/A} {0 {}}
2N/Ado_test auth-1.58 {
2N/A set ::authargs
2N/A} {t2 data1.txt main {}}
2N/Ado_test auth-1.59 {
2N/A execsql {SELECT * FROM t2}
2N/A} {11 2 33}
2N/Ado_test auth-1.60 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_COPY"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_OK
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {COPY t2 FROM 'data1.txt' USING DELIMITERS ':'}
2N/A} {0 {}}
2N/Ado_test auth-1.61 {
2N/A set ::authargs
2N/A} {t2 data1.txt main {}}
2N/Ado_test auth-1.62 {
2N/A execsql {SELECT * FROM t2}
2N/A} {11 2 33 7 8 9}
2N/A
2N/Ado_test auth-1.63 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="sqlite_master"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TABLE t2}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.64 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2}
2N/Ado_test auth-1.65 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="t2"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TABLE t2}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.66 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2}
2N/Ado_test auth-1.67 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="sqlite_temp_master"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TABLE t1}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.68 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/Ado_test auth-1.69 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="t1"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TABLE t1}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.70 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/A
2N/Ado_test auth-1.71 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="sqlite_master"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TABLE t2}
2N/A} {0 {}}
2N/Ado_test auth-1.72 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2}
2N/Ado_test auth-1.73 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="t2"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TABLE t2}
2N/A} {0 {}}
2N/Ado_test auth-1.74 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2}
2N/Ado_test auth-1.75 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="sqlite_temp_master"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TABLE t1}
2N/A} {0 {}}
2N/Ado_test auth-1.76 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/Ado_test auth-1.77 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="t1"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TABLE t1}
2N/A} {0 {}}
2N/Ado_test auth-1.78 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/A
2N/Ado_test auth-1.79 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_VIEW"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE VIEW v1 AS SELECT a+1,b+1 FROM t2}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.80 {
2N/A set ::authargs
2N/A} {v1 {} main {}}
2N/Ado_test auth-1.81 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2}
2N/Ado_test auth-1.82 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_VIEW"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE VIEW v1 AS SELECT a+1,b+1 FROM t2}
2N/A} {0 {}}
2N/Ado_test auth-1.83 {
2N/A set ::authargs
2N/A} {v1 {} main {}}
2N/Ado_test auth-1.84 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2}
2N/A
2N/Ado_test auth-1.85 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_TEMP_VIEW"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE TEMPORARY VIEW v1 AS SELECT a+1,b+1 FROM t2}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.86 {
2N/A set ::authargs
2N/A} {v1 {} temp {}}
2N/Ado_test auth-1.87 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/Ado_test auth-1.88 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_TEMP_VIEW"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE TEMPORARY VIEW v1 AS SELECT a+1,b+1 FROM t2}
2N/A} {0 {}}
2N/Ado_test auth-1.89 {
2N/A set ::authargs
2N/A} {v1 {} temp {}}
2N/Ado_test auth-1.90 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/A
2N/Ado_test auth-1.91 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_INSERT" && $arg1=="sqlite_master"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE VIEW v1 AS SELECT a+1,b+1 FROM t2}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.92 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2}
2N/Ado_test auth-1.93 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_INSERT" && $arg1=="sqlite_master"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE VIEW v1 AS SELECT a+1,b+1 FROM t2}
2N/A} {0 {}}
2N/Ado_test auth-1.94 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2}
2N/A
2N/Ado_test auth-1.95 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_INSERT" && $arg1=="sqlite_temp_master"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE TEMPORARY VIEW v1 AS SELECT a+1,b+1 FROM t2}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.96 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/Ado_test auth-1.97 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_INSERT" && $arg1=="sqlite_temp_master"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE TEMPORARY VIEW v1 AS SELECT a+1,b+1 FROM t2}
2N/A} {0 {}}
2N/Ado_test auth-1.98 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/A
2N/Ado_test auth-1.99 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="sqlite_master"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {
2N/A CREATE VIEW v2 AS SELECT a+1,b+1 FROM t2;
2N/A DROP VIEW v2
2N/A }
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.100 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2 v2}
2N/Ado_test auth-1.101 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_VIEW"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP VIEW v2}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.102 {
2N/A set ::authargs
2N/A} {v2 {} main {}}
2N/Ado_test auth-1.103 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2 v2}
2N/Ado_test auth-1.104 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="sqlite_master"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP VIEW v2}
2N/A} {0 {}}
2N/Ado_test auth-1.105 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2 v2}
2N/Ado_test auth-1.106 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_VIEW"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP VIEW v2}
2N/A} {0 {}}
2N/Ado_test auth-1.107 {
2N/A set ::authargs
2N/A} {v2 {} main {}}
2N/Ado_test auth-1.108 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2 v2}
2N/Ado_test auth-1.109 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_VIEW"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_OK
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP VIEW v2}
2N/A} {0 {}}
2N/Ado_test auth-1.110 {
2N/A set ::authargs
2N/A} {v2 {} main {}}
2N/Ado_test auth-1.111 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2}
2N/A
2N/A
2N/Ado_test auth-1.112 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="sqlite_temp_master"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {
2N/A CREATE TEMP VIEW v1 AS SELECT a+1,b+1 FROM t1;
2N/A DROP VIEW v1
2N/A }
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.113 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1 v1}
2N/Ado_test auth-1.114 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_TEMP_VIEW"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP VIEW v1}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.115 {
2N/A set ::authargs
2N/A} {v1 {} temp {}}
2N/Ado_test auth-1.116 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1 v1}
2N/Ado_test auth-1.117 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="sqlite_temp_master"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP VIEW v1}
2N/A} {0 {}}
2N/Ado_test auth-1.118 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1 v1}
2N/Ado_test auth-1.119 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_TEMP_VIEW"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP VIEW v1}
2N/A} {0 {}}
2N/Ado_test auth-1.120 {
2N/A set ::authargs
2N/A} {v1 {} temp {}}
2N/Ado_test auth-1.121 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1 v1}
2N/Ado_test auth-1.122 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_TEMP_VIEW"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_OK
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP VIEW v1}
2N/A} {0 {}}
2N/Ado_test auth-1.123 {
2N/A set ::authargs
2N/A} {v1 {} temp {}}
2N/Ado_test auth-1.124 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/A
2N/Ado_test auth-1.125 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_TRIGGER"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {
2N/A CREATE TRIGGER r2 DELETE on t2 BEGIN
2N/A SELECT NULL;
2N/A END;
2N/A }
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.126 {
2N/A set ::authargs
2N/A} {r2 t2 main {}}
2N/Ado_test auth-1.127 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2}
2N/Ado_test auth-1.128 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_INSERT" && $arg1=="sqlite_master"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {
2N/A CREATE TRIGGER r2 DELETE on t2 BEGIN
2N/A SELECT NULL;
2N/A END;
2N/A }
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.129 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2}
2N/Ado_test auth-1.130 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_TRIGGER"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {
2N/A CREATE TRIGGER r2 DELETE on t2 BEGIN
2N/A SELECT NULL;
2N/A END;
2N/A }
2N/A} {0 {}}
2N/Ado_test auth-1.131 {
2N/A set ::authargs
2N/A} {r2 t2 main {}}
2N/Ado_test auth-1.132 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2}
2N/Ado_test auth-1.133 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_INSERT" && $arg1=="sqlite_master"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {
2N/A CREATE TRIGGER r2 DELETE on t2 BEGIN
2N/A SELECT NULL;
2N/A END;
2N/A }
2N/A} {0 {}}
2N/Ado_test auth-1.134 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2}
2N/Ado_test auth-1.135 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_TRIGGER"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_OK
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {
2N/A CREATE TABLE tx(id);
2N/A CREATE TRIGGER r2 AFTER INSERT ON t2 BEGIN
2N/A INSERT INTO tx VALUES(NEW.rowid);
2N/A END;
2N/A }
2N/A} {0 {}}
2N/Ado_test auth-1.136.1 {
2N/A set ::authargs
2N/A} {r2 t2 main {}}
2N/Ado_test auth-1.136.2 {
2N/A execsql {
2N/A SELECT name FROM sqlite_master WHERE type='trigger'
2N/A }
2N/A} {r2}
2N/Ado_test auth-1.136.3 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A lappend ::authargs $code $arg1 $arg2 $arg3 $arg4
2N/A return SQLITE_OK
2N/A }
2N/A set ::authargs {}
2N/A execsql {
2N/A INSERT INTO t2 VALUES(1,2,3);
2N/A }
2N/A set ::authargs
2N/A} {SQLITE_INSERT t2 {} main {} SQLITE_INSERT tx {} main r2 SQLITE_READ t2 ROWID main r2}
2N/Ado_test auth-1.136.4 {
2N/A execsql {
2N/A SELECT * FROM tx;
2N/A }
2N/A} {3}
2N/Ado_test auth-1.137 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2 tx r2}
2N/Ado_test auth-1.138 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_TEMP_TRIGGER"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {
2N/A CREATE TRIGGER r1 DELETE on t1 BEGIN
2N/A SELECT NULL;
2N/A END;
2N/A }
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.139 {
2N/A set ::authargs
2N/A} {r1 t1 temp {}}
2N/Ado_test auth-1.140 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/Ado_test auth-1.141 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_INSERT" && $arg1=="sqlite_temp_master"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {
2N/A CREATE TRIGGER r1 DELETE on t1 BEGIN
2N/A SELECT NULL;
2N/A END;
2N/A }
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.142 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/Ado_test auth-1.143 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_TEMP_TRIGGER"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {
2N/A CREATE TRIGGER r1 DELETE on t1 BEGIN
2N/A SELECT NULL;
2N/A END;
2N/A }
2N/A} {0 {}}
2N/Ado_test auth-1.144 {
2N/A set ::authargs
2N/A} {r1 t1 temp {}}
2N/Ado_test auth-1.145 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/Ado_test auth-1.146 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_INSERT" && $arg1=="sqlite_temp_master"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {
2N/A CREATE TRIGGER r1 DELETE on t1 BEGIN
2N/A SELECT NULL;
2N/A END;
2N/A }
2N/A} {0 {}}
2N/Ado_test auth-1.147 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/Ado_test auth-1.148 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_TEMP_TRIGGER"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_OK
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {
2N/A CREATE TRIGGER r1 DELETE on t1 BEGIN
2N/A SELECT NULL;
2N/A END;
2N/A }
2N/A} {0 {}}
2N/Ado_test auth-1.149 {
2N/A set ::authargs
2N/A} {r1 t1 temp {}}
2N/Ado_test auth-1.150 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1 r1}
2N/A
2N/Ado_test auth-1.151 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="sqlite_master"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TRIGGER r2}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.152 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2 tx r2}
2N/Ado_test auth-1.153 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_TRIGGER"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TRIGGER r2}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.154 {
2N/A set ::authargs
2N/A} {r2 t2 main {}}
2N/Ado_test auth-1.155 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2 tx r2}
2N/Ado_test auth-1.156 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="sqlite_master"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TRIGGER r2}
2N/A} {0 {}}
2N/Ado_test auth-1.157 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2 tx r2}
2N/Ado_test auth-1.158 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_TRIGGER"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TRIGGER r2}
2N/A} {0 {}}
2N/Ado_test auth-1.159 {
2N/A set ::authargs
2N/A} {r2 t2 main {}}
2N/Ado_test auth-1.160 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2 tx r2}
2N/Ado_test auth-1.161 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_TRIGGER"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_OK
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TRIGGER r2}
2N/A} {0 {}}
2N/Ado_test auth-1.162 {
2N/A set ::authargs
2N/A} {r2 t2 main {}}
2N/Ado_test auth-1.163 {
2N/A execsql {
2N/A DROP TABLE tx;
2N/A DELETE FROM t2 WHERE a=1 AND b=2 AND c=3;
2N/A SELECT name FROM sqlite_master;
2N/A }
2N/A} {t2}
2N/A
2N/Ado_test auth-1.164 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="sqlite_temp_master"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TRIGGER r1}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.165 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1 r1}
2N/Ado_test auth-1.166 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_TEMP_TRIGGER"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TRIGGER r1}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.167 {
2N/A set ::authargs
2N/A} {r1 t1 temp {}}
2N/Ado_test auth-1.168 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1 r1}
2N/Ado_test auth-1.169 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="sqlite_temp_master"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TRIGGER r1}
2N/A} {0 {}}
2N/Ado_test auth-1.170 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1 r1}
2N/Ado_test auth-1.171 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_TEMP_TRIGGER"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TRIGGER r1}
2N/A} {0 {}}
2N/Ado_test auth-1.172 {
2N/A set ::authargs
2N/A} {r1 t1 temp {}}
2N/Ado_test auth-1.173 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1 r1}
2N/Ado_test auth-1.174 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_TEMP_TRIGGER"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_OK
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP TRIGGER r1}
2N/A} {0 {}}
2N/Ado_test auth-1.175 {
2N/A set ::authargs
2N/A} {r1 t1 temp {}}
2N/Ado_test auth-1.176 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/A
2N/Ado_test auth-1.177 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_INDEX"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE INDEX i2 ON t2(a)}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.178 {
2N/A set ::authargs
2N/A} {i2 t2 main {}}
2N/Ado_test auth-1.179 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2}
2N/Ado_test auth-1.180 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_INSERT" && $arg1=="sqlite_master"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE INDEX i2 ON t2(a)}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.181 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2}
2N/Ado_test auth-1.182 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_INDEX"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE INDEX i2 ON t2(b)}
2N/A} {0 {}}
2N/Ado_test auth-1.183 {
2N/A set ::authargs
2N/A} {i2 t2 main {}}
2N/Ado_test auth-1.184 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2}
2N/Ado_test auth-1.185 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_INSERT" && $arg1=="sqlite_master"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE INDEX i2 ON t2(b)}
2N/A} {0 {}}
2N/Ado_test auth-1.186 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2}
2N/Ado_test auth-1.187 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_INDEX"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_OK
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE INDEX i2 ON t2(a)}
2N/A} {0 {}}
2N/Ado_test auth-1.188 {
2N/A set ::authargs
2N/A} {i2 t2 main {}}
2N/Ado_test auth-1.189 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2 i2}
2N/A
2N/Ado_test auth-1.190 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_TEMP_INDEX"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE INDEX i1 ON t1(a)}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.191 {
2N/A set ::authargs
2N/A} {i1 t1 temp {}}
2N/Ado_test auth-1.192 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/Ado_test auth-1.193 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_INSERT" && $arg1=="sqlite_temp_master"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE INDEX i1 ON t1(b)}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.194 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/Ado_test auth-1.195 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_TEMP_INDEX"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE INDEX i1 ON t1(b)}
2N/A} {0 {}}
2N/Ado_test auth-1.196 {
2N/A set ::authargs
2N/A} {i1 t1 temp {}}
2N/Ado_test auth-1.197 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/Ado_test auth-1.198 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_INSERT" && $arg1=="sqlite_temp_master"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE INDEX i1 ON t1(c)}
2N/A} {0 {}}
2N/Ado_test auth-1.199 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/Ado_test auth-1.200 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_CREATE_TEMP_INDEX"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_OK
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {CREATE INDEX i1 ON t1(a)}
2N/A} {0 {}}
2N/Ado_test auth-1.201 {
2N/A set ::authargs
2N/A} {i1 t1 temp {}}
2N/Ado_test auth-1.202 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1 i1}
2N/A
2N/Ado_test auth-1.203 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="sqlite_master"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP INDEX i2}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.204 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2 i2}
2N/Ado_test auth-1.205 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_INDEX"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP INDEX i2}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.206 {
2N/A set ::authargs
2N/A} {i2 t2 main {}}
2N/Ado_test auth-1.207 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2 i2}
2N/Ado_test auth-1.208 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="sqlite_master"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP INDEX i2}
2N/A} {0 {}}
2N/Ado_test auth-1.209 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2 i2}
2N/Ado_test auth-1.210 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_INDEX"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP INDEX i2}
2N/A} {0 {}}
2N/Ado_test auth-1.211 {
2N/A set ::authargs
2N/A} {i2 t2 main {}}
2N/Ado_test auth-1.212 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2 i2}
2N/Ado_test auth-1.213 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_INDEX"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_OK
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP INDEX i2}
2N/A} {0 {}}
2N/Ado_test auth-1.214 {
2N/A set ::authargs
2N/A} {i2 t2 main {}}
2N/Ado_test auth-1.215 {
2N/A execsql {SELECT name FROM sqlite_master}
2N/A} {t2}
2N/A
2N/Ado_test auth-1.216 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="sqlite_temp_master"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP INDEX i1}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.217 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1 i1}
2N/Ado_test auth-1.218 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_TEMP_INDEX"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP INDEX i1}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.219 {
2N/A set ::authargs
2N/A} {i1 t1 temp {}}
2N/Ado_test auth-1.220 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1 i1}
2N/Ado_test auth-1.221 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DELETE" && $arg1=="sqlite_temp_master"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP INDEX i1}
2N/A} {0 {}}
2N/Ado_test auth-1.222 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1 i1}
2N/Ado_test auth-1.223 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_TEMP_INDEX"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP INDEX i1}
2N/A} {0 {}}
2N/Ado_test auth-1.224 {
2N/A set ::authargs
2N/A} {i1 t1 temp {}}
2N/Ado_test auth-1.225 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1 i1}
2N/Ado_test auth-1.226 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DROP_TEMP_INDEX"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_OK
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {DROP INDEX i1}
2N/A} {0 {}}
2N/Ado_test auth-1.227 {
2N/A set ::authargs
2N/A} {i1 t1 temp {}}
2N/Ado_test auth-1.228 {
2N/A execsql {SELECT name FROM sqlite_temp_master}
2N/A} {t1}
2N/A
2N/Ado_test auth-1.229 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_PRAGMA"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {PRAGMA full_column_names=on}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.230 {
2N/A set ::authargs
2N/A} {full_column_names on {} {}}
2N/Ado_test auth-1.231 {
2N/A execsql2 {SELECT a FROM t2}
2N/A} {a 11 a 7}
2N/Ado_test auth-1.232 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_PRAGMA"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {PRAGMA full_column_names=on}
2N/A} {0 {}}
2N/Ado_test auth-1.233 {
2N/A set ::authargs
2N/A} {full_column_names on {} {}}
2N/Ado_test auth-1.234 {
2N/A execsql2 {SELECT a FROM t2}
2N/A} {a 11 a 7}
2N/Ado_test auth-1.235 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_PRAGMA"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_OK
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {PRAGMA full_column_names=on}
2N/A} {0 {}}
2N/Ado_test auth-1.236 {
2N/A execsql2 {SELECT a FROM t2}
2N/A} {t2.a 11 t2.a 7}
2N/Ado_test auth-1.237 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_PRAGMA"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_OK
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {PRAGMA full_column_names=OFF}
2N/A} {0 {}}
2N/Ado_test auth-1.238 {
2N/A set ::authargs
2N/A} {full_column_names OFF {} {}}
2N/Ado_test auth-1.239 {
2N/A execsql2 {SELECT a FROM t2}
2N/A} {a 11 a 7}
2N/A
2N/Ado_test auth-1.240 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_TRANSACTION"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {BEGIN}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.241 {
2N/A set ::authargs
2N/A} {BEGIN {} {} {}}
2N/Ado_test auth-1.242 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_TRANSACTION" && $arg1!="BEGIN"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {BEGIN; INSERT INTO t2 VALUES(44,55,66); COMMIT}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.243 {
2N/A set ::authargs
2N/A} {COMMIT {} {} {}}
2N/Ado_test auth-1.244 {
2N/A execsql {SELECT * FROM t2}
2N/A} {11 2 33 7 8 9 44 55 66}
2N/Ado_test auth-1.245 {
2N/A catchsql {ROLLBACK}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.246 {
2N/A set ::authargs
2N/A} {ROLLBACK {} {} {}}
2N/Ado_test auth-1.247 {
2N/A catchsql {END TRANSACTION}
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.248 {
2N/A set ::authargs
2N/A} {COMMIT {} {} {}}
2N/Ado_test auth-1.249 {
2N/A db authorizer {}
2N/A catchsql {ROLLBACK}
2N/A} {0 {}}
2N/Ado_test auth-1.250 {
2N/A execsql {SELECT * FROM t2}
2N/A} {11 2 33 7 8 9}
2N/A
2N/A# ticket #340 - authorization for ATTACH and DETACH.
2N/A#
2N/Ado_test auth-1.251 {
2N/A db authorizer ::auth
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_ATTACH"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {
2N/A ATTACH DATABASE ':memory:' AS test1
2N/A }
2N/A} {0 {}}
2N/Ado_test auth-1.252 {
2N/A set ::authargs
2N/A} {:memory: {} {} {}}
2N/Ado_test auth-1.253 {
2N/A catchsql {DETACH DATABASE test1}
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_ATTACH"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {
2N/A ATTACH DATABASE ':memory:' AS test1;
2N/A }
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.254 {
2N/A lindex [execsql {PRAGMA database_list}] 7
2N/A} {}
2N/Ado_test auth-1.255 {
2N/A catchsql {DETACH DATABASE test1}
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_ATTACH"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {
2N/A ATTACH DATABASE ':memory:' AS test1;
2N/A }
2N/A} {0 {}}
2N/Ado_test auth-1.256 {
2N/A lindex [execsql {PRAGMA database_list}] 7
2N/A} {}
2N/Ado_test auth-1.257 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DETACH"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_OK
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A execsql {ATTACH DATABASE ':memory:' AS test1}
2N/A catchsql {
2N/A DETACH DATABASE test1;
2N/A }
2N/A} {0 {}}
2N/Ado_test auth-1.258 {
2N/A lindex [execsql {PRAGMA database_list}] 7
2N/A} {}
2N/Ado_test auth-1.259 {
2N/A execsql {ATTACH DATABASE ':memory:' AS test1}
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DETACH"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {
2N/A DETACH DATABASE test1;
2N/A }
2N/A} {0 {}}
2N/Ado_test auth-1.260 {
2N/A lindex [execsql {PRAGMA database_list}] 7
2N/A} {test1}
2N/Ado_test auth-1.261 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_DETACH"} {
2N/A set ::authargs [list $arg1 $arg2 $arg3 $arg4]
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {
2N/A DETACH DATABASE test1;
2N/A }
2N/A} {1 {not authorized}}
2N/Ado_test auth-1.262 {
2N/A lindex [execsql {PRAGMA database_list}] 7
2N/A} {test1}
2N/Adb authorizer {}
2N/Aexecsql {DETACH DATABASE test1}
2N/A
2N/A
2N/Ado_test auth-2.1 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_READ" && $arg1=="t3" && $arg2=="x"} {
2N/A return SQLITE_DENY
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A db authorizer ::auth
2N/A execsql {CREATE TABLE t3(x INTEGER PRIMARY KEY, y, z)}
2N/A catchsql {SELECT * FROM t3}
2N/A} {1 {access to t3.x is prohibited}}
2N/Ado_test auth-2.1 {
2N/A catchsql {SELECT y,z FROM t3}
2N/A} {0 {}}
2N/Ado_test auth-2.2 {
2N/A catchsql {SELECT ROWID,y,z FROM t3}
2N/A} {1 {access to t3.x is prohibited}}
2N/Ado_test auth-2.3 {
2N/A catchsql {SELECT OID,y,z FROM t3}
2N/A} {1 {access to t3.x is prohibited}}
2N/Ado_test auth-2.4 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_READ" && $arg1=="t3" && $arg2=="x"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A execsql {INSERT INTO t3 VALUES(44,55,66)}
2N/A catchsql {SELECT * FROM t3}
2N/A} {0 {{} 55 66}}
2N/Ado_test auth-2.5 {
2N/A catchsql {SELECT rowid,y,z FROM t3}
2N/A} {0 {{} 55 66}}
2N/Ado_test auth-2.6 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_READ" && $arg1=="t3" && $arg2=="ROWID"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {SELECT * FROM t3}
2N/A} {0 {44 55 66}}
2N/Ado_test auth-2.7 {
2N/A catchsql {SELECT ROWID,y,z FROM t3}
2N/A} {0 {44 55 66}}
2N/Ado_test auth-2.8 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="ROWID"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {SELECT ROWID,b,c FROM t2}
2N/A} {0 {{} 2 33 {} 8 9}}
2N/Ado_test auth-2.9.1 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="ROWID"} {
2N/A return bogus
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {SELECT ROWID,b,c FROM t2}
2N/A} {1 {illegal return value (999) from the authorization function - should be SQLITE_OK, SQLITE_IGNORE, or SQLITE_DENY}}
2N/Ado_test auth-2.9.2 {
2N/A db errorcode
2N/A} {21}
2N/Ado_test auth-2.10 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_SELECT"} {
2N/A return bogus
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {SELECT ROWID,b,c FROM t2}
2N/A} {1 {illegal return value (1) from the authorization function - should be SQLITE_OK, SQLITE_IGNORE, or SQLITE_DENY}}
2N/Ado_test auth-2.11.1 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_READ" && $arg2=="a"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {SELECT * FROM t2, t3}
2N/A} {0 {{} 2 33 44 55 66 {} 8 9 44 55 66}}
2N/Ado_test auth-2.11.2 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_READ" && $arg2=="x"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A catchsql {SELECT * FROM t2, t3}
2N/A} {0 {11 2 33 {} 55 66 7 8 9 {} 55 66}}
2N/A
2N/A# Make sure the OLD and NEW pseudo-tables of a trigger get authorized.
2N/A#
2N/Ado_test auth-3.1 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A return SQLITE_OK
2N/A }
2N/A execsql {
2N/A CREATE TABLE tx(a1,a2,b1,b2,c1,c2);
2N/A CREATE TRIGGER r1 AFTER UPDATE ON t2 FOR EACH ROW BEGIN
2N/A INSERT INTO tx VALUES(OLD.a,NEW.a,OLD.b,NEW.b,OLD.c,NEW.c);
2N/A END;
2N/A UPDATE t2 SET a=a+1;
2N/A SELECT * FROM tx;
2N/A }
2N/A} {11 12 2 2 33 33 7 8 8 8 9 9}
2N/Ado_test auth-3.2 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="c"} {
2N/A return SQLITE_IGNORE
2N/A }
2N/A return SQLITE_OK
2N/A }
2N/A execsql {
2N/A DELETE FROM tx;
2N/A UPDATE t2 SET a=a+100;
2N/A SELECT * FROM tx;
2N/A }
2N/A} {12 112 2 2 {} {} 8 108 8 8 {} {}}
2N/A
2N/A# Make sure the names of views and triggers are passed on on arg4.
2N/A#
2N/Ado_test auth-4.1 {
2N/A proc auth {code arg1 arg2 arg3 arg4} {
2N/A lappend ::authargs $code $arg1 $arg2 $arg3 $arg4
2N/A return SQLITE_OK
2N/A }
2N/A set authargs {}
2N/A execsql {
2N/A UPDATE t2 SET a=a+1;
2N/A }
2N/A set authargs
2N/A} [list \
2N/A SQLITE_READ t2 a main {} \
2N/A SQLITE_UPDATE t2 a main {} \
2N/A SQLITE_INSERT tx {} main r1 \
2N/A SQLITE_READ t2 a main r1 \
2N/A SQLITE_READ t2 a main r1 \
2N/A SQLITE_READ t2 b main r1 \
2N/A SQLITE_READ t2 b main r1 \
2N/A SQLITE_READ t2 c main r1 \
2N/A SQLITE_READ t2 c main r1]
2N/Ado_test auth-4.2 {
2N/A execsql {
2N/A CREATE VIEW v1 AS SELECT a+b AS x FROM t2;
2N/A CREATE TABLE v1chng(x1,x2);
2N/A CREATE TRIGGER r2 INSTEAD OF UPDATE ON v1 BEGIN
2N/A INSERT INTO v1chng VALUES(OLD.x,NEW.x);
2N/A END;
2N/A SELECT * FROM v1;
2N/A }
2N/A} {115 117}
2N/Ado_test auth-4.3 {
2N/A set authargs {}
2N/A execsql {
2N/A UPDATE v1 SET x=1 WHERE x=117
2N/A }
2N/A set authargs
2N/A} [list \
2N/A SQLITE_UPDATE v1 x main {} \
2N/A SQLITE_READ v1 x main {} \
2N/A SQLITE_SELECT {} {} {} v1 \
2N/A SQLITE_READ t2 a main v1 \
2N/A SQLITE_READ t2 b main v1 \
2N/A SQLITE_INSERT v1chng {} main r2 \
2N/A SQLITE_READ v1 x main r2 \
2N/A SQLITE_READ v1 x main r2]
2N/Ado_test auth-4.4 {
2N/A execsql {
2N/A CREATE TRIGGER r3 INSTEAD OF DELETE ON v1 BEGIN
2N/A INSERT INTO v1chng VALUES(OLD.x,NULL);
2N/A END;
2N/A SELECT * FROM v1;
2N/A }
2N/A} {115 117}
2N/Ado_test auth-4.5 {
2N/A set authargs {}
2N/A execsql {
2N/A DELETE FROM v1 WHERE x=117
2N/A }
2N/A set authargs
2N/A} [list \
2N/A SQLITE_DELETE v1 {} main {} \
2N/A SQLITE_READ v1 x main {} \
2N/A SQLITE_SELECT {} {} {} v1 \
2N/A SQLITE_READ t2 a main v1 \
2N/A SQLITE_READ t2 b main v1 \
2N/A SQLITE_INSERT v1chng {} main r3 \
2N/A SQLITE_READ v1 x main r3]
2N/A
2N/Afinish_test