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 # The focus of this file is testing the session module. Specifically,
13 # testing support for WITHOUT ROWID tables.
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}
23 set testprefix sessionwor
28 forcedelete test.db test.db2
39 do_execsql_test 1.$tn.0 "CREATE TABLE t1(a PRIMARY KEY, b) $wo ;"
41 do_iterator_test 1.$tn.1 t1 {
42 INSERT INTO t1 VALUES('one', 'two');
44 {INSERT t1 0 X. {} {t one t two}}
47 do_iterator_test 1.$tn.2 t1 {
48 UPDATE t1 SET b='three'
50 {UPDATE t1 0 X. {t one t two} {{} {} t three}}
53 do_iterator_test 1.$tn.3 t1 {
54 REPLACE INTO t1 VALUES('one', 'four');
56 {UPDATE t1 0 X. {t one t three} {{} {} t four}}
59 do_iterator_test 1.$tn.4 t1 {
62 {DELETE t1 0 X. {t one t four} {}}
72 do_execsql_test 2.$tn.0.1 "CREATE TABLE t1(a INTEGER PRIMARY KEY, b) $wo ;"
73 do_execsql_test 2.$tn.0.2 "CREATE TABLE t2(a INTEGER PRIMARY KEY, b) $wo ;"
74 do_execsql_test 2.$tn.0.3 "CREATE TABLE t3(a INTEGER PRIMARY KEY, b) $wo ;"
76 do_iterator_test 1.1 t1 {
77 INSERT INTO t1 VALUES(1, 'two');
79 {INSERT t1 0 X. {} {i 1 t two}}
82 do_iterator_test 2.$tn.2 t1 {
83 UPDATE t1 SET b='three'
85 {UPDATE t1 0 X. {i 1 t two} {{} {} t three}}
88 do_iterator_test 2.$tn.3 t1 {
89 REPLACE INTO t1 VALUES(1, 'four');
91 {UPDATE t1 0 X. {i 1 t three} {{} {} t four}}
94 do_iterator_test 2.$tn.4 t1 {
97 {DELETE t1 0 X. {i 1 t four} {}}
100 do_execsql_test 2.$tn.5 {
101 INSERT INTO t1 VALUES(1, 'one');
102 INSERT INTO t1 VALUES(2, 'two');
103 INSERT INTO t1 VALUES(3, 'three');
106 do_iterator_test 2.$tn.6 t2 {
107 INSERT INTO t2 SELECT a, b FROM t1
109 {INSERT t2 0 X. {} {i 1 t one}}
110 {INSERT t2 0 X. {} {i 2 t two}}
111 {INSERT t2 0 X. {} {i 3 t three}}
113 do_iterator_test 2.$tn.7 t3 {
114 INSERT INTO t3 SELECT * FROM t1
116 {INSERT t3 0 X. {} {i 1 t one}}
117 {INSERT t3 0 X. {} {i 2 t two}}
118 {INSERT t3 0 X. {} {i 3 t three}}