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
22 set testprefix incrblobfault
25 CREATE TABLE blob(x INTEGER PRIMARY KEY, v BLOB);
26 INSERT INTO blob VALUES(1, 'hello world');
27 INSERT INTO blob VALUES(2, 'world hello');
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 INSERT INTO blob SELECT NULL, v FROM blob;
34 INSERT INTO blob SELECT NULL, v FROM blob;
35 INSERT INTO blob SELECT NULL, v FROM blob;
36 INSERT INTO blob SELECT NULL, v FROM blob;
37 INSERT INTO blob SELECT NULL, v FROM blob;
40 do_faultsim_test 1 -prep {
42 set ::blob [db incrblob blob v 1]
44 if {[catch {sqlite3_blob_reopen $::blob 1000}]} {
45 error [sqlite3_errmsg db]
48 faultsim_test_result {0 {}}
52 do_faultsim_test 2 -prep {
54 set ::blob [db incrblob blob v 1]
56 if {[catch {sqlite3_blob_reopen $::blob -1}]} {
57 error [sqlite3_errmsg db]
60 faultsim_test_result {1 {no such rowid: -1}} {1 {disk I/O error}}
64 do_faultsim_test 3 -prep {
67 set ::blob [db incrblob blob v 1]
70 faultsim_test_result {0 {hello world}}
71 catch { close $::blob }