Debian Codegraph @

ext/session/sessionblob.test

raw
1 # 2024 November 04
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 if {![info exists testdir]} {
14 set testdir [file join [file dirname [info script]] .. .. test]
15 }
16 source [file join [file dirname [info script]] session_common.tcl]
17 source $testdir/tester.tcl
18 ifcapable !session {finish_test; return}
19
20 if {$::tcl_platform(pointerSize)<8} {
21 finish_test
22 return
23 }
24
25 set testprefix sessionblob
26
27 forcedelete test.db2
28 sqlite3 db2 test.db2
29
30 set NBLOB 2000000
31
32 do_execsql_test 1.0 {
33 CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
34 INSERT INTO t1 VALUES(123, zeroblob($NBLOB));
35 }
36
37 do_test 1.1 {
38 sqlite3session S db main
39 S attach t1
40 } {}
41
42 set b2 [string repeat x 1000]
43 do_test 1.2 {
44 set ::blob [db incrblob t1 b 123]
45 for {set ii 0} {$ii < $NBLOB} {incr ii [string length $b2]} {
46 seek $::blob $ii
47 puts -nonewline $::blob $b2
48 }
49 close $::blob
50 } {}
51
52 S delete
53
54 finish_test
55