OLD | NEW |
1 # 2010 December 1 | 1 # 2010 December 1 |
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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 sqlite3 db2 test.db | 227 sqlite3 db2 test.db |
228 } {} | 228 } {} |
229 | 229 |
230 do_test 4.4.1 { | 230 do_test 4.4.1 { |
231 catchsql { SELECT * FROM t1 } db2 | 231 catchsql { SELECT * FROM t1 } db2 |
232 } {0 {1 2}} | 232 } {0 {1 2}} |
233 do_test 4.4.2 { | 233 do_test 4.4.2 { |
234 catchsql { SELECT * FROM t2 } db2 | 234 catchsql { SELECT * FROM t2 } db2 |
235 } {1 {database disk image is malformed}} | 235 } {1 {database disk image is malformed}} |
236 | 236 |
| 237 #------------------------------------------------------------------------- |
| 238 # Confirm that it is possible to get an SQLITE_BUSY_SNAPSHOT error from |
| 239 # "BEGIN EXCLUSIVE" if the connection already has an open read-transaction. |
| 240 # |
| 241 db close |
| 242 db2 close |
| 243 reset_db |
| 244 sqlite3 db2 test.db |
| 245 do_execsql_test 5.1 { |
| 246 PRAGMA journal_mode = wal; |
| 247 CREATE TABLE t1(x, y); |
| 248 INSERT INTO t1 VALUES(1, 2); |
| 249 INSERT INTO t1 VALUES(3, 4); |
| 250 } {wal} |
| 251 do_test 5.2 { |
| 252 set res [list] |
| 253 db eval { |
| 254 SELECT * FROM t1 |
| 255 } { |
| 256 if {$x==1} { |
| 257 db2 eval { INSERT INTO t1 VALUES(5, 6) } |
| 258 } |
| 259 if {$x==3} { |
| 260 set res [catchsql {BEGIN EXCLUSIVE}] |
| 261 lappend res [sqlite3_extended_errcode db] |
| 262 } |
| 263 } |
| 264 set res |
| 265 } {1 {database is locked} SQLITE_BUSY_SNAPSHOT} |
| 266 |
| 267 |
237 | 268 |
238 finish_test | 269 finish_test |
239 | |
OLD | NEW |