diff options
author | dan miller | 2007-10-20 02:49:29 +0000 |
---|---|---|
committer | dan miller | 2007-10-20 02:49:29 +0000 |
commit | e36d23a85ebff914d74bb541558c2b6082b78edb (patch) | |
tree | 54b58fdf162e78af64055282a6035c8d2443389d /libraries/sqlite/unix/sqlite-3.5.1/test/auth2.test | |
parent | * Fixed an issue whereby avatar chat distances were being calculated against ... (diff) | |
download | opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.zip opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.gz opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.bz2 opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.xz |
sqlite source (unix build) added to libraries
Diffstat (limited to 'libraries/sqlite/unix/sqlite-3.5.1/test/auth2.test')
-rw-r--r-- | libraries/sqlite/unix/sqlite-3.5.1/test/auth2.test | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/libraries/sqlite/unix/sqlite-3.5.1/test/auth2.test b/libraries/sqlite/unix/sqlite-3.5.1/test/auth2.test new file mode 100644 index 0000000..6e9a463 --- /dev/null +++ b/libraries/sqlite/unix/sqlite-3.5.1/test/auth2.test | |||
@@ -0,0 +1,75 @@ | |||
1 | # 2006 Aug 24 | ||
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 | # This file implements regression tests for SQLite library. The | ||
12 | # focus of this script is testing the sqlite3_set_authorizer() API | ||
13 | # and related functionality. | ||
14 | # | ||
15 | # $Id: auth2.test,v 1.1 2006/08/24 14:59:46 drh Exp $ | ||
16 | # | ||
17 | |||
18 | set testdir [file dirname $argv0] | ||
19 | source $testdir/tester.tcl | ||
20 | |||
21 | # disable this test if the SQLITE_OMIT_AUTHORIZATION macro is | ||
22 | # defined during compilation. | ||
23 | if {[catch {db auth {}} msg]} { | ||
24 | finish_test | ||
25 | return | ||
26 | } | ||
27 | |||
28 | do_test auth2-1.1 { | ||
29 | execsql { | ||
30 | CREATE TABLE t1(a,b,c); | ||
31 | INSERT INTO t1 VALUES(1,2,3); | ||
32 | } | ||
33 | set ::flist {} | ||
34 | proc auth {code arg1 arg2 arg3 arg4} { | ||
35 | if {$code=="SQLITE_FUNCTION"} { | ||
36 | lappend ::flist $arg2 | ||
37 | if {$arg2=="max"} { | ||
38 | return SQLITE_DENY | ||
39 | } elseif {$arg2=="min"} { | ||
40 | return SQLITE_IGNORE | ||
41 | } else { | ||
42 | return SQLITE_OK | ||
43 | } | ||
44 | } | ||
45 | return SQLITE_OK | ||
46 | } | ||
47 | db authorizer ::auth | ||
48 | catchsql {SELECT max(a,b,c) FROM t1} | ||
49 | } {1 {not authorized to use function: max}} | ||
50 | do_test auth2-1.2 { | ||
51 | set ::flist | ||
52 | } max | ||
53 | do_test auth2-1.3 { | ||
54 | set ::flist {} | ||
55 | catchsql {SELECT min(a,b,c) FROM t1} | ||
56 | } {0 {{}}} | ||
57 | do_test auth2-1.4 { | ||
58 | set ::flist | ||
59 | } min | ||
60 | do_test auth2-1.5 { | ||
61 | set ::flist {} | ||
62 | catchsql {SELECT coalesce(min(a,b,c),999) FROM t1} | ||
63 | } {0 999} | ||
64 | do_test auth2-1.6 { | ||
65 | set ::flist | ||
66 | } {coalesce min} | ||
67 | do_test auth2-1.7 { | ||
68 | set ::flist {} | ||
69 | catchsql {SELECT coalesce(a,b,c) FROM t1} | ||
70 | } {0 1} | ||
71 | do_test auth2-1.8 { | ||
72 | set ::flist | ||
73 | } coalesce | ||
74 | |||
75 | finish_test | ||