OLD | NEW |
1 # 2008 October 27 | 1 # 2008 October 27 |
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 # | 11 # |
12 # Test that the truncate optimization is disabled if the SQLITE_DELETE | 12 # Test that the truncate optimization is disabled if the SQLITE_DELETE |
13 # authorization callback returns SQLITE_IGNORE. | 13 # authorization callback returns SQLITE_IGNORE. |
14 # | 14 # |
15 # $Id: auth3.test,v 1.2 2009/05/04 01:58:31 drh Exp $ | 15 # Test that authorizer is disabled during schema parsing. |
16 # | |
17 | 16 |
18 set testdir [file dirname $argv0] | 17 set testdir [file dirname $argv0] |
19 source $testdir/tester.tcl | 18 source $testdir/tester.tcl |
20 | 19 |
21 # disable this test if the SQLITE_OMIT_AUTHORIZATION macro is | 20 # disable this test if the SQLITE_OMIT_AUTHORIZATION macro is |
22 # defined during compilation. | 21 # defined during compilation. |
23 if {[catch {db auth {}} msg]} { | 22 if {[catch {db auth {}} msg]} { |
24 finish_test | 23 finish_test |
25 return | 24 return |
26 } | 25 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 INSERT INTO t1 VALUES(1, 2, 3); | 100 INSERT INTO t1 VALUES(1, 2, 3); |
102 INSERT INTO t1 VALUES(4, 5, 6); | 101 INSERT INTO t1 VALUES(4, 5, 6); |
103 } | 102 } |
104 set sqlite_search_count 0 | 103 set sqlite_search_count 0 |
105 execsql { | 104 execsql { |
106 DELETE FROM t1; | 105 DELETE FROM t1; |
107 } | 106 } |
108 set sqlite_search_count | 107 set sqlite_search_count |
109 } {1} | 108 } {1} |
110 | 109 |
| 110 # 2016-07-28. A problem report from a private client complaining about |
| 111 # an authorizer failure during an ALTER TABLE. The solution (I think) is |
| 112 # to disable the authorizer during schema parsing. |
| 113 # |
| 114 proc auth {code args} { |
| 115 if {$code=="SQLITE_READ" && [regexp {DoNotRead} $args]} { |
| 116 return SQLITE_DENY |
| 117 } |
| 118 return SQLITE_OK |
| 119 } |
| 120 do_execsql_test auth3-3.0 { |
| 121 CREATE TEMPORARY TABLE TempTable ( |
| 122 key TEXT NOT NULL ON CONFLICT FAIL UNIQUE ON CONFLICT REPLACE, |
| 123 value TEXT NOT NULL ON CONFLICT FAIL); |
| 124 ALTER TABLE TempTable RENAME TO DoNotRead; |
| 125 SELECT name FROM temp.sqlite_master; |
| 126 } {DoNotRead sqlite_autoindex_DoNotRead_1} |
| 127 |
111 finish_test | 128 finish_test |
OLD | NEW |