OLD | NEW |
(Empty) | |
| 1 # 2010 October 26 |
| 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 # |
| 13 |
| 14 set testdir [file dirname $argv0] |
| 15 source $testdir/tester.tcl |
| 16 |
| 17 set testprefix incrblobfault |
| 18 |
| 19 do_execsql_test 1.0 { |
| 20 CREATE TABLE blob(x INTEGER PRIMARY KEY, v BLOB); |
| 21 INSERT INTO blob VALUES(1, 'hello world'); |
| 22 INSERT INTO blob VALUES(2, 'world hello'); |
| 23 INSERT INTO blob SELECT NULL, v FROM blob; |
| 24 INSERT INTO blob SELECT NULL, v FROM blob; |
| 25 INSERT INTO blob SELECT NULL, v FROM blob; |
| 26 INSERT INTO blob SELECT NULL, v FROM blob; |
| 27 INSERT INTO blob SELECT NULL, v FROM blob; |
| 28 INSERT INTO blob SELECT NULL, v FROM blob; |
| 29 INSERT INTO blob SELECT NULL, v FROM blob; |
| 30 INSERT INTO blob SELECT NULL, v FROM blob; |
| 31 INSERT INTO blob SELECT NULL, v FROM blob; |
| 32 INSERT INTO blob SELECT NULL, v FROM blob; |
| 33 } |
| 34 |
| 35 do_faultsim_test 1 -prep { |
| 36 sqlite3 db test.db |
| 37 set ::blob [db incrblob blob v 1] |
| 38 } -body { |
| 39 if {[catch {sqlite3_blob_reopen $::blob 1000}]} { |
| 40 error [sqlite3_errmsg db] |
| 41 } |
| 42 } -test { |
| 43 faultsim_test_result {0 {}} |
| 44 close $::blob |
| 45 } |
| 46 |
| 47 do_faultsim_test 2 -prep { |
| 48 sqlite3 db test.db |
| 49 set ::blob [db incrblob blob v 1] |
| 50 } -body { |
| 51 if {[catch {sqlite3_blob_reopen $::blob -1}]} { |
| 52 error [sqlite3_errmsg db] |
| 53 } |
| 54 } -test { |
| 55 faultsim_test_result {1 {no such rowid: -1}} |
| 56 close $::blob |
| 57 } |
| 58 |
| 59 do_faultsim_test 3 -prep { |
| 60 sqlite3 db test.db |
| 61 } -body { |
| 62 set ::blob [db incrblob blob v 1] |
| 63 gets $::blob |
| 64 } -test { |
| 65 faultsim_test_result {0 {hello world}} |
| 66 catch { close $::blob } |
| 67 } |
| 68 |
| 69 finish_test |
| 70 |
OLD | NEW |