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 #***********************************************************************
12 # $Id: tkt2332.test,v 1.4 2007/09/12 17:01:45 danielk1977 Exp $
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
18 ifcapable !incrblob||!tclvar {
25 CREATE TABLE blobs (k INTEGER PRIMARY KEY, v BLOB);
26 PRAGMA cache_size = 100;
31 foreach Len [list 10000 100000 1000000] {
32 do_test tkt2332.$Len.1 {
33 set val "[expr rand()][expr rand()][expr rand()][expr rand()][expr rand()]"
34 set ::blobstr [string range \
35 [string repeat $val [expr ($Len/[string length $val])+1]] 0 [expr $Len-1]
38 db eval { INSERT INTO blobs VALUES($::iKey, zeroblob($Len)) }
41 do_test tkt2332.$Len.2 {
43 SELECT length(v) FROM blobs WHERE k = $::iKey;
47 do_test tkt2332.$Len.3 {
48 set ::fd [db incrblob blobs v $::iKey]
49 puts -nonewline $::fd $::blobstr
53 do_test tkt2332.$Len.4 {
54 execsql { SELECT length(v) FROM blobs WHERE k = $::iKey; }
57 do_test tkt2332.$Len.5 {
58 lindex [execsql {SELECT v FROM blobs WHERE k = $::iKey}] 0