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 #***********************************************************************
13 set testdir [file dirname $argv0]
14 source $testdir/tester.tcl
15 ifcapable {!incrblob} { finish_test ; return }
16 set testprefix incrblob4
20 PRAGMA page_size = 1024;
21 CREATE TABLE t1(k INTEGER PRIMARY KEY, v);
26 set data [list a b c d e f g h i j k l m n o p q r s t u v w x y z]
28 set blob [string repeat $d 900]
29 execsql { INSERT INTO t1(v) VALUES($blob) }
40 set blob [db incrblob t1 v 5]
45 execsql { DELETE FROM t1 }
58 set blob [db incrblob t1 v 10]
63 set new [string repeat % 900]
64 execsql { DELETE FROM t1 WHERE k=10 }
65 execsql { DELETE FROM t1 WHERE k=9 }
66 execsql { INSERT INTO t1(v) VALUES($new) }
78 set blob [db incrblob t1 v 20]
83 set new [string repeat % 900]
84 execsql { UPDATE t1 SET v = $new WHERE k = 20 }
85 execsql { DELETE FROM t1 WHERE k=19 }
86 execsql { INSERT INTO t1(v) VALUES($new) }
89 #-------------------------------------------------------------------------
90 # Test that it is not possible to DROP a table with an incremental blob
94 CREATE TABLE t2(a INTEGER PRIMARY KEY, b);
95 INSERT INTO t2 VALUES(456, '0123456789');
98 set blob [db incrblob -readonly t2 b 456]
101 do_catchsql_test 4.3 {
103 } {1 {database table is locked}}
105 sqlite3_extended_errcode db