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 #***********************************************************************
11 # This file implements regression tests for SQLite sessions extension.
12 # Specifically, it tests that sessions work when the database is modified
13 # using incremental blob handles.
16 if {![info exists testdir]} {
17 set testdir [file join [file dirname [info script]] .. .. test]
19 source [file join [file dirname [info script]] session_common.tcl]
20 source $testdir/tester.tcl
21 ifcapable !session {finish_test; return}
22 ifcapable !incrblob {finish_test; return}
24 set testprefix session6
26 proc do_then_apply_tcl {tcl {dbname main}} {
27 proc xConflict args { return "OMIT" }
29 sqlite3session S db $dbname
30 db eval "SELECT name FROM $dbname.sqlite_master WHERE type = 'table'" {
34 sqlite3changeset_apply db2 [S changeset] xConflict
42 proc x {args} {puts $args}
48 CREATE TABLE t1(a PRIMARY KEY, b);
49 CREATE TABLE t2(c PRIMARY KEY, d);
56 db eval { INSERT INTO t1 VALUES(1, 'helloworld') }
57 db eval { INSERT INTO t2 VALUES(2, 'onetwothree') }
63 set fd [db incrblob t1 b 1]
64 puts -nonewline $fd 1234567890
70 # Test an attached database.
74 file copy test.db2 test.db3
75 execsql { ATTACH 'test.db3' AS aux; }
78 set fd [db incrblob aux t2 d 1]
79 puts -nonewline $fd fourfivesix