OLD | NEW |
1 # 2002 May 10 | 1 # 2002 May 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 #*********************************************************************** |
(...skipping 21 matching lines...) Expand all Loading... |
32 } msg | 32 } msg |
33 ] | 33 ] |
34 lappend r $msg | 34 lappend r $msg |
35 } | 35 } |
36 | 36 |
37 | 37 |
38 # Make sure the test logic works | 38 # Make sure the test logic works |
39 # | 39 # |
40 do_test misuse-1.1 { | 40 do_test misuse-1.1 { |
41 db close | 41 db close |
42 catch {file delete -force test2.db} | 42 catch {forcedelete test2.db} |
43 catch {file delete -force test2.db-journal} | 43 catch {forcedelete test2.db-journal} |
44 sqlite3 db test2.db; set ::DB [sqlite3_connection_pointer db] | 44 sqlite3 db test2.db; set ::DB [sqlite3_connection_pointer db] |
45 execsql { | 45 execsql { |
46 CREATE TABLE t1(a,b); | 46 CREATE TABLE t1(a,b); |
47 INSERT INTO t1 VALUES(1,2); | 47 INSERT INTO t1 VALUES(1,2); |
48 } | 48 } |
49 catchsql2 { | 49 catchsql2 { |
50 SELECT * FROM t1 | 50 SELECT * FROM t1 |
51 } | 51 } |
52 } {0 {a b 1 2}} | 52 } {0 {a b 1 2}} |
53 do_test misuse-1.2 { | 53 do_test misuse-1.2 { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 catchsql2 {SELECT * FROM t1} | 164 catchsql2 {SELECT * FROM t1} |
165 } {0 {a b 1 2}} | 165 } {0 {a b 1 2}} |
166 do_test misuse-4.3 { | 166 do_test misuse-4.3 { |
167 set v [catch { | 167 set v [catch { |
168 db eval {SELECT * FROM t1} {} { | 168 db eval {SELECT * FROM t1} {} { |
169 set r [sqlite3_close $::DB] | 169 set r [sqlite3_close $::DB] |
170 } | 170 } |
171 } msg] | 171 } msg] |
172 lappend v $msg $r | 172 lappend v $msg $r |
173 } {0 {} SQLITE_BUSY} | 173 } {0 {} SQLITE_BUSY} |
174 do_test misuse-4.4 { | 174 |
| 175 if {[clang_sanitize_address]==0} { |
| 176 do_test misuse-4.4 { |
175 # Flush the TCL statement cache here, otherwise the sqlite3_close() will | 177 # Flush the TCL statement cache here, otherwise the sqlite3_close() will |
176 # fail because there are still un-finalized() VDBEs. | 178 # fail because there are still un-finalized() VDBEs. |
177 db cache flush | 179 db cache flush |
178 sqlite3_close $::DB | 180 sqlite3_close $::DB |
179 catchsql2 {SELECT * FROM t1} | 181 catchsql2 {SELECT * FROM t1} |
180 } {1 {library routine called out of sequence}} | 182 } {1 {library routine called out of sequence}} |
181 do_test misuse-4.5 { | 183 do_test misuse-4.5 { |
182 catchsql { | 184 catchsql { |
183 SELECT * FROM t1 | 185 SELECT * FROM t1 |
184 } | 186 } |
185 } {1 {library routine called out of sequence}} | 187 } {1 {library routine called out of sequence}} |
186 | 188 |
187 # Attempt to use a database after it has been closed. | 189 # Attempt to use a database after it has been closed. |
188 # | 190 # |
189 do_test misuse-5.1 { | 191 do_test misuse-5.1 { |
190 db close | 192 db close |
191 sqlite3 db test2.db; set ::DB [sqlite3_connection_pointer db] | 193 sqlite3 db test2.db; set ::DB [sqlite3_connection_pointer db] |
192 execsql { | 194 execsql { |
193 SELECT * FROM t1 | 195 SELECT * FROM t1 |
194 } | 196 } |
195 } {1 2} | 197 } {1 2} |
196 do_test misuse-5.2 { | 198 do_test misuse-5.2 { |
197 catchsql2 {SELECT * FROM t1} | 199 catchsql2 {SELECT * FROM t1} |
198 } {0 {a b 1 2}} | 200 } {0 {a b 1 2}} |
199 do_test misuse-5.3 { | 201 do_test misuse-5.3 { |
200 db close | 202 db close |
201 set r [catch { | 203 set r [catch { |
202 sqlite3_prepare $::DB {SELECT * FROM t1} -1 TAIL | 204 sqlite3_prepare $::DB {SELECT * FROM t1} -1 TAIL |
203 } msg] | 205 } msg] |
204 lappend r $msg | 206 lappend r $msg |
205 } {1 {(21) library routine called out of sequence}} | 207 } {1 {(21) library routine called out of sequence}} |
| 208 } |
206 | 209 |
207 finish_test | 210 finish_test |
OLD | NEW |