| OLD | NEW |
| (Empty) |
| 1 # 2009 March 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 # | |
| 12 # $Id: jrnlmode2.test,v 1.6 2009/06/05 17:09:12 drh Exp $ | |
| 13 | |
| 14 set testdir [file dirname $argv0] | |
| 15 source $testdir/tester.tcl | |
| 16 | |
| 17 ifcapable {!pager_pragmas} { | |
| 18 finish_test | |
| 19 return | |
| 20 } | |
| 21 | |
| 22 #------------------------------------------------------------------------- | |
| 23 # Test overview: | |
| 24 # | |
| 25 # jrnlmode2-1.*: Demonstrate bug #3745 | |
| 26 # jrnlmode2-2.*: Demonstrate bug #3751 | |
| 27 # | |
| 28 | |
| 29 do_test jrnlmode2-1.1 { | |
| 30 execsql { | |
| 31 PRAGMA journal_mode = persist; | |
| 32 CREATE TABLE t1(a, b); | |
| 33 INSERT INTO t1 VALUES(1, 2); | |
| 34 } | |
| 35 } {persist} | |
| 36 | |
| 37 do_test jrnlmode2-1.2 { | |
| 38 file exists test.db-journal | |
| 39 } {1} | |
| 40 | |
| 41 do_test jrnlmode2-1.3 { | |
| 42 sqlite3 db2 test.db | |
| 43 execsql { SELECT * FROM t1 } db2 | |
| 44 } {1 2} | |
| 45 | |
| 46 do_test jrnlmode2-1.4 { | |
| 47 execsql { | |
| 48 INSERT INTO t1 VALUES(3, 4); | |
| 49 BEGIN; | |
| 50 SELECT * FROM t1; | |
| 51 } | |
| 52 execsql { PRAGMA lock_status } | |
| 53 } {main shared temp closed} | |
| 54 | |
| 55 do_test jrnlmode2-1.5 { | |
| 56 file exists test.db-journal | |
| 57 } {1} | |
| 58 | |
| 59 do_test jrnlmode2-1.6 { | |
| 60 catchsql { SELECT * FROM t1 } db2 | |
| 61 } {0 {1 2 3 4}} | |
| 62 | |
| 63 do_test jrnlmode2-1.7 { | |
| 64 execsql { COMMIT } | |
| 65 catchsql { SELECT * FROM t1 } db2 | |
| 66 } {0 {1 2 3 4}} | |
| 67 | |
| 68 | |
| 69 | |
| 70 do_test jrnlmode2-2.1 { | |
| 71 db2 close | |
| 72 execsql { PRAGMA journal_mode = truncate } | |
| 73 execsql { INSERT INTO t1 VALUES(5, 6) } | |
| 74 } {} | |
| 75 | |
| 76 do_test jrnlmode2-2.2 { | |
| 77 file exists test.db-journal | |
| 78 } {1} | |
| 79 | |
| 80 do_test jrnlmode2-2.3 { | |
| 81 file size test.db-journal | |
| 82 } {0} | |
| 83 | |
| 84 do_test jrnlmode2-2.4 { | |
| 85 sqlite3 db2 test.db -readonly 1 | |
| 86 catchsql { SELECT * FROM t1 } db2 | |
| 87 } {0 {1 2 3 4 5 6}} | |
| 88 | |
| 89 do_test jrnlmode2-2.5 { | |
| 90 file delete test.db-journal | |
| 91 } {} | |
| 92 | |
| 93 do_test jrnlmode2-2.6 { | |
| 94 sqlite3 db2 test.db -readonly 1 | |
| 95 catchsql { SELECT * FROM t1 } db2 | |
| 96 } {0 {1 2 3 4 5 6}} | |
| 97 | |
| 98 catch { db2 close } | |
| 99 finish_test | |
| OLD | NEW |