| OLD | NEW |
| 1 # 2005 January 19 | 1 # 2005 January 19 |
| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 db2 eval {SELECT a, b FROM numbers ORDER BY a} { | 72 db2 eval {SELECT a, b FROM numbers ORDER BY a} { |
| 73 if {$a==32} { | 73 if {$a==32} { |
| 74 execsql { | 74 execsql { |
| 75 DELETE FROM numbers; | 75 DELETE FROM numbers; |
| 76 } db1 | 76 } db1 |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 list $a $count | 79 list $a $count |
| 80 } {32 64} | 80 } {32 64} |
| 81 | 81 |
| 82 #--------------------------------------------------------------------------- | |
| 83 # These tests, shared2.2.*, test the outcome when data is added to or | |
| 84 # removed from a table due to a rollback while a read-uncommitted | |
| 85 # cursor is scanning it. | |
| 86 # | |
| 87 do_test shared2-2.1 { | |
| 88 execsql { | |
| 89 INSERT INTO numbers VALUES(1, 'Medium length text field'); | |
| 90 INSERT INTO numbers VALUES(2, 'Medium length text field'); | |
| 91 INSERT INTO numbers VALUES(3, 'Medium length text field'); | |
| 92 INSERT INTO numbers VALUES(4, 'Medium length text field'); | |
| 93 BEGIN; | |
| 94 DELETE FROM numbers WHERE (a%2)=0; | |
| 95 } db1 | |
| 96 set res [list] | |
| 97 db2 eval { | |
| 98 SELECT a FROM numbers ORDER BY a; | |
| 99 } { | |
| 100 lappend res $a | |
| 101 if {$a==3} { | |
| 102 execsql {ROLLBACK} db1 | |
| 103 } | |
| 104 } | |
| 105 set res | |
| 106 } {1 3 4} | |
| 107 do_test shared2-2.2 { | |
| 108 execsql { | |
| 109 BEGIN; | |
| 110 INSERT INTO numbers VALUES(5, 'Medium length text field'); | |
| 111 INSERT INTO numbers VALUES(6, 'Medium length text field'); | |
| 112 } db1 | |
| 113 set res [list] | |
| 114 db2 eval { | |
| 115 SELECT a FROM numbers ORDER BY a; | |
| 116 } { | |
| 117 lappend res $a | |
| 118 if {$a==5} { | |
| 119 execsql {ROLLBACK} db1 | |
| 120 } | |
| 121 } | |
| 122 set res | |
| 123 } {1 2 3 4 5} | |
| 124 | 82 |
| 125 db1 close | 83 db1 close |
| 126 db2 close | 84 db2 close |
| 127 | 85 |
| 128 do_test shared2-3.2 { | 86 do_test shared2-3.2 { |
| 129 sqlite3_enable_shared_cache 1 | 87 sqlite3_enable_shared_cache 1 |
| 130 } {1} | 88 } {1} |
| 131 | 89 |
| 132 file delete -force test.db | 90 forcedelete test.db |
| 133 | 91 |
| 134 sqlite3 db test.db | 92 sqlite3 db test.db |
| 135 do_test shared2-4.1 { | 93 do_test shared2-4.1 { |
| 136 execsql { | 94 execsql { |
| 137 CREATE TABLE t0(a, b); | 95 CREATE TABLE t0(a, b); |
| 138 CREATE TABLE t1(a, b DEFAULT 'hello world'); | 96 CREATE TABLE t1(a, b DEFAULT 'hello world'); |
| 139 } | 97 } |
| 140 } {} | 98 } {} |
| 141 db close | 99 db close |
| 142 | 100 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 172 # turn on exclusive-locking mode for some reason. | 130 # turn on exclusive-locking mode for some reason. |
| 173 do_multiclient_test {tn} { | 131 do_multiclient_test {tn} { |
| 174 sql1 { CREATE TABLE t1(a, b) } | 132 sql1 { CREATE TABLE t1(a, b) } |
| 175 sql2 { CREATE TABLE t2(a, b) } | 133 sql2 { CREATE TABLE t2(a, b) } |
| 176 do_test shared2-6.$tn.1 { sql1 { SELECT * FROM t2 } } {} | 134 do_test shared2-6.$tn.1 { sql1 { SELECT * FROM t2 } } {} |
| 177 do_test shared2-6.$tn.2 { sql2 { SELECT * FROM t1 } } {} | 135 do_test shared2-6.$tn.2 { sql2 { SELECT * FROM t1 } } {} |
| 178 } | 136 } |
| 179 | 137 |
| 180 sqlite3_enable_shared_cache $::enable_shared_cache | 138 sqlite3_enable_shared_cache $::enable_shared_cache |
| 181 finish_test | 139 finish_test |
| OLD | NEW |