OLD | NEW |
1 # 2006 June 10 | 1 # 2006 June 10 |
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 #*********************************************************************** |
11 # This file implements regression tests for SQLite library. The | 11 # This file implements regression tests for SQLite library. The |
12 # focus of this file is the authorisation callback and virtual tables. | 12 # focus of this file is the authorisation callback and virtual tables. |
13 # | 13 # |
14 # $Id: vtab3.test,v 1.3 2008/07/12 14:52:21 drh Exp $ | 14 # $Id: vtab3.test,v 1.3 2008/07/12 14:52:21 drh Exp $ |
15 | 15 |
16 set testdir [file dirname $argv0] | 16 set testdir [file dirname $argv0] |
17 source $testdir/tester.tcl | 17 source $testdir/tester.tcl |
18 | 18 |
19 ifcapable !vtab||!auth { | 19 ifcapable !vtab||!auth { |
20 finish_test | 20 finish_test |
21 return | 21 return |
22 } | 22 } |
23 | 23 |
24 set ::auth_fail 0 | 24 set ::auth_fail 0 |
25 set ::auth_log [list] | 25 set ::auth_log [list] |
26 set ::auth_filter [list SQLITE_READ SQLITE_UPDATE SQLITE_SELECT SQLITE_PRAGMA] | 26 set ::auth_filter [list SQLITE_READ SQLITE_UPDATE SQLITE_SELECT SQLITE_PRAGMA] |
27 | 27 |
28 proc auth {code arg1 arg2 arg3 arg4} { | 28 proc auth {code arg1 arg2 arg3 arg4 args} { |
29 if {[lsearch $::auth_filter $code]>-1} { | 29 if {[lsearch $::auth_filter $code]>-1} { |
30 return SQLITE_OK | 30 return SQLITE_OK |
31 } | 31 } |
32 lappend ::auth_log $code $arg1 $arg2 $arg3 $arg4 | 32 lappend ::auth_log $code $arg1 $arg2 $arg3 $arg4 |
33 incr ::auth_fail -1 | 33 incr ::auth_fail -1 |
34 if {$::auth_fail == 0} { | 34 if {$::auth_fail == 0} { |
35 return SQLITE_DENY | 35 return SQLITE_DENY |
36 } | 36 } |
37 return SQLITE_OK | 37 return SQLITE_OK |
38 } | 38 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 DROP TABLE pachyderm; | 131 DROP TABLE pachyderm; |
132 } | 132 } |
133 } {0 {}} | 133 } {0 {}} |
134 do_test vtab3-1.8.2 { | 134 do_test vtab3-1.8.2 { |
135 execsql { | 135 execsql { |
136 SELECT name FROM sqlite_master WHERE type = 'table'; | 136 SELECT name FROM sqlite_master WHERE type = 'table'; |
137 } | 137 } |
138 } {elephant} | 138 } {elephant} |
139 | 139 |
140 finish_test | 140 finish_test |
OLD | NEW |