3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
14 set testdir [file dirname $argv0]
15 source $testdir/tester.tcl
17 set testprefix incrblobfault
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;
35 do_faultsim_test 1 -prep {
37 set ::blob [db incrblob blob v 1]
39 if {[catch {sqlite3_blob_reopen $::blob 1000}]} {
40 error [sqlite3_errmsg db]
43 faultsim_test_result {0 {}}
47 do_faultsim_test 2 -prep {
49 set ::blob [db incrblob blob v 1]
51 if {[catch {sqlite3_blob_reopen $::blob -1}]} {
52 error [sqlite3_errmsg db]
55 faultsim_test_result {1 {no such rowid: -1}} {1 {disk I/O error}}
59 do_faultsim_test 3 -prep {
62 set ::blob [db incrblob blob v 1]
65 faultsim_test_result {0 {hello world}}
66 catch { close $::blob }