OLD | NEW |
1 # 2003 April 4 | 1 # 2003 April 4 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 1958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1969 do_test auth-1.294 { | 1969 do_test auth-1.294 { |
1970 set ::authargs {} | 1970 set ::authargs {} |
1971 execsql { | 1971 execsql { |
1972 CREATE TABLE t4(a,b,c); | 1972 CREATE TABLE t4(a,b,c); |
1973 CREATE INDEX t4i1 ON t4(a); | 1973 CREATE INDEX t4i1 ON t4(a); |
1974 CREATE INDEX t4i2 ON t4(b,a,c); | 1974 CREATE INDEX t4i2 ON t4(b,a,c); |
1975 INSERT INTO t4 VALUES(1,2,3); | 1975 INSERT INTO t4 VALUES(1,2,3); |
1976 ANALYZE; | 1976 ANALYZE; |
1977 } | 1977 } |
1978 set ::authargs | 1978 set ::authargs |
1979 } {t4 {} main {}} | 1979 } {t4 {} main {} t2 {} main {}} |
1980 do_test auth-1.295 { | 1980 do_test auth-1.295 { |
1981 execsql { | 1981 execsql { |
1982 SELECT count(*) FROM sqlite_stat1; | 1982 SELECT count(*) FROM sqlite_stat1; |
1983 } | 1983 } |
1984 } 2 | 1984 } 3 |
1985 proc auth {code args} { | 1985 proc auth {code args} { |
1986 if {$code=="SQLITE_ANALYZE"} { | 1986 if {$code=="SQLITE_ANALYZE"} { |
1987 set ::authargs [concat $::authargs $args] | 1987 set ::authargs [concat $::authargs $args] |
1988 return SQLITE_DENY | 1988 return SQLITE_DENY |
1989 } | 1989 } |
1990 return SQLITE_OK | 1990 return SQLITE_OK |
1991 } | 1991 } |
1992 do_test auth-1.296 { | 1992 do_test auth-1.296 { |
1993 set ::authargs {} | 1993 set ::authargs {} |
1994 catchsql { | 1994 catchsql { |
1995 ANALYZE; | 1995 ANALYZE; |
1996 } | 1996 } |
1997 } {1 {not authorized}} | 1997 } {1 {not authorized}} |
1998 do_test auth-1.297 { | 1998 do_test auth-1.297 { |
1999 execsql { | 1999 execsql { |
2000 SELECT count(*) FROM sqlite_stat1; | 2000 SELECT count(*) FROM sqlite_stat1; |
2001 } | 2001 } |
2002 } 2 | 2002 } 3 |
2003 } ;# ifcapable analyze | 2003 } ;# ifcapable analyze |
2004 | 2004 |
2005 | 2005 |
2006 # Authorization for ALTER TABLE ADD COLUMN. | 2006 # Authorization for ALTER TABLE ADD COLUMN. |
2007 # These tests are omitted if the library | 2007 # These tests are omitted if the library |
2008 # was built without ALTER TABLE support. | 2008 # was built without ALTER TABLE support. |
2009 ifcapable {altertable} { | 2009 ifcapable {altertable} { |
2010 do_test auth-1.300 { | 2010 do_test auth-1.300 { |
2011 execsql {CREATE TABLE t5(x)} | 2011 execsql {CREATE TABLE t5(x)} |
2012 proc auth {code arg1 arg2 arg3 arg4} { | 2012 proc auth {code arg1 arg2 arg3 arg4} { |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2241 } | 2241 } |
2242 } {115 117} | 2242 } {115 117} |
2243 do_test auth-4.3 { | 2243 do_test auth-4.3 { |
2244 set authargs {} | 2244 set authargs {} |
2245 execsql { | 2245 execsql { |
2246 UPDATE v1 SET x=1 WHERE x=117 | 2246 UPDATE v1 SET x=1 WHERE x=117 |
2247 } | 2247 } |
2248 set authargs | 2248 set authargs |
2249 } [list \ | 2249 } [list \ |
2250 SQLITE_UPDATE v1 x main {} \ | 2250 SQLITE_UPDATE v1 x main {} \ |
2251 SQLITE_INSERT v1chng {} main r2 \ | |
2252 SQLITE_READ v1 x main r2 \ | |
2253 SQLITE_READ v1 x main r2 \ | |
2254 SQLITE_SELECT {} {} {} v1 \ | 2251 SQLITE_SELECT {} {} {} v1 \ |
2255 SQLITE_READ t2 a main v1 \ | 2252 SQLITE_READ t2 a main v1 \ |
2256 SQLITE_READ t2 b main v1 \ | 2253 SQLITE_READ t2 b main v1 \ |
2257 SQLITE_SELECT {} {} {} {} \ | 2254 SQLITE_SELECT {} {} {} {} \ |
2258 SQLITE_READ v1 x main v1 \ | 2255 SQLITE_READ v1 x main v1 \ |
| 2256 SQLITE_INSERT v1chng {} main r2 \ |
| 2257 SQLITE_READ v1 x main r2 \ |
| 2258 SQLITE_READ v1 x main r2 \ |
2259 ] | 2259 ] |
| 2260 |
2260 do_test auth-4.4 { | 2261 do_test auth-4.4 { |
2261 execsql { | 2262 execsql { |
2262 CREATE TRIGGER r3 INSTEAD OF DELETE ON v1 BEGIN | 2263 CREATE TRIGGER r3 INSTEAD OF DELETE ON v1 BEGIN |
2263 INSERT INTO v1chng VALUES(OLD.x,NULL); | 2264 INSERT INTO v1chng VALUES(OLD.x,NULL); |
2264 END; | 2265 END; |
2265 SELECT * FROM v1; | 2266 SELECT * FROM v1; |
2266 } | 2267 } |
2267 } {115 117} | 2268 } {115 117} |
2268 do_test auth-4.5 { | 2269 do_test auth-4.5 { |
2269 set authargs {} | 2270 set authargs {} |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2351 execsql { SELECT * FROM t5 } | 2352 execsql { SELECT * FROM t5 } |
2352 } {1} | 2353 } {1} |
2353 } | 2354 } |
2354 | 2355 |
2355 | 2356 |
2356 rename proc {} | 2357 rename proc {} |
2357 rename proc_real proc | 2358 rename proc_real proc |
2358 | 2359 |
2359 | 2360 |
2360 finish_test | 2361 finish_test |
OLD | NEW |