| OLD | NEW |
| 1 # 2008 August 27 | 1 # 2008 August 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 #*********************************************************************** |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 # Do a large update that aborts do to a constraint failure near | 155 # Do a large update that aborts do to a constraint failure near |
| 156 # the end. This stresses the statement journal mechanism. | 156 # the end. This stresses the statement journal mechanism. |
| 157 # | 157 # |
| 158 do_test trans2-$i.10 { | 158 do_test trans2-$i.10 { |
| 159 catchsql { | 159 catchsql { |
| 160 UPDATE t1 SET u1=u1||'x', | 160 UPDATE t1 SET u1=u1||'x', |
| 161 z = CASE WHEN id<$max_rowid | 161 z = CASE WHEN id<$max_rowid |
| 162 THEN zeroblob((random()&65535)%5000 + 1000) END; | 162 THEN zeroblob((random()&65535)%5000 + 1000) END; |
| 163 } | 163 } |
| 164 } {1 {t1.z may not be NULL}} | 164 } {1 {NOT NULL constraint failed: t1.z}} |
| 165 do_test trans2-$i.11 { | 165 do_test trans2-$i.11 { |
| 166 db eval {SELECT md5sum(u1), md5sum(u2) FROM t1 ORDER BY id} | 166 db eval {SELECT md5sum(u1), md5sum(u2) FROM t1 ORDER BY id} |
| 167 } $newres | 167 } $newres |
| 168 | 168 |
| 169 # Delete all of the newly inserted records. Verify that the database | 169 # Delete all of the newly inserted records. Verify that the database |
| 170 # is back to its original state. | 170 # is back to its original state. |
| 171 # | 171 # |
| 172 do_test trans2-$i.20 { | 172 do_test trans2-$i.20 { |
| 173 set s "DELETE FROM t1 WHERE id IN ([join $todel ,]);" | 173 set s "DELETE FROM t1 WHERE id IN ([join $todel ,]);" |
| 174 append modsql $s\n | 174 append modsql $s\n |
| 175 db eval $s | 175 db eval $s |
| 176 db eval {SELECT md5sum(u1), md5sum(u2) FROM t1 ORDER BY id} | 176 db eval {SELECT md5sum(u1), md5sum(u2) FROM t1 ORDER BY id} |
| 177 } $origres | 177 } $origres |
| 178 | 178 |
| 179 # Do another large update that aborts do to a constraint failure near | 179 # Do another large update that aborts do to a constraint failure near |
| 180 # the end. This stresses the statement journal mechanism. | 180 # the end. This stresses the statement journal mechanism. |
| 181 # | 181 # |
| 182 do_test trans2-$i.30 { | 182 do_test trans2-$i.30 { |
| 183 catchsql { | 183 catchsql { |
| 184 UPDATE t1 SET u1=u1||'x', | 184 UPDATE t1 SET u1=u1||'x', |
| 185 z = CASE WHEN id<$max1 | 185 z = CASE WHEN id<$max1 |
| 186 THEN zeroblob((random()&65535)%5000 + 1000) END; | 186 THEN zeroblob((random()&65535)%5000 + 1000) END; |
| 187 } | 187 } |
| 188 } {1 {t1.z may not be NULL}} | 188 } {1 {NOT NULL constraint failed: t1.z}} |
| 189 do_test trans2-$i.31 { | 189 do_test trans2-$i.31 { |
| 190 db eval {SELECT md5sum(u1), md5sum(u2) FROM t1 ORDER BY id} | 190 db eval {SELECT md5sum(u1), md5sum(u2) FROM t1 ORDER BY id} |
| 191 } $origres | 191 } $origres |
| 192 | 192 |
| 193 # Redo the inserts | 193 # Redo the inserts |
| 194 # | 194 # |
| 195 do_test trans2-$i.40 { | 195 do_test trans2-$i.40 { |
| 196 db eval $inssql | 196 db eval $inssql |
| 197 append modsql $inssql | 197 append modsql $inssql |
| 198 db eval {SELECT md5sum(u1), md5sum(u2) FROM t1 ORDER BY id} | 198 db eval {SELECT md5sum(u1), md5sum(u2) FROM t1 ORDER BY id} |
| (...skipping 24 matching lines...) Expand all Loading... |
| 223 } | 223 } |
| 224 db eval COMMIT | 224 db eval COMMIT |
| 225 db eval {SELECT md5sum(u1), md5sum(u2) FROM t1 ORDER BY id} | 225 db eval {SELECT md5sum(u1), md5sum(u2) FROM t1 ORDER BY id} |
| 226 } $newres | 226 } $newres |
| 227 integrity_check trans2-$i.93 | 227 integrity_check trans2-$i.93 |
| 228 } | 228 } |
| 229 | 229 |
| 230 unset -nocomplain data i max_rowid todel n rec max1 id origres newres | 230 unset -nocomplain data i max_rowid todel n rec max1 id origres newres |
| 231 unset -nocomplain inssql modsql s j z | 231 unset -nocomplain inssql modsql s j z |
| 232 finish_test | 232 finish_test |
| OLD | NEW |