Add a new non-goal to the JNI README.md.
[sqlite.git] / ext / session / sessionH.test
blobe1b12571c694174af5e09a5de18835157a32e867
1 # 2018 January 18
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 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 set testprefix sessionH
21 forcedelete test.db2
22 sqlite3 db2 test.db2
24 do_test 1.0 {
25   do_common_sql {
26     CREATE TABLE t1(a, b, c, PRIMARY KEY(a, b));
27   }
28   do_then_apply_sql -ignorenoop {
29     WITH s(i) AS (
30       VALUES(1) UNION ALL SELECT i+1 FROM s WHERe i<10000
31     )
32     INSERT INTO t1 SELECT 'abcde', randomblob(16), i FROM s;
33   }
34   compare_db db db2
35 } {}
37 #------------------------------------------------------------------------
38 db2 close
39 reset_db
41 do_execsql_test 2.0 {
42   CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c);
43   INSERT INTO main.t1 VALUES(1, 2, 3), (4, 5, 6), (7, 8, 9);
46 do_test 2.1 {
47   sqlite3session S db main
48   S attach *
49   db eval {
50     BEGIN;
51       INSERT INTO t1 VALUES(10, 11, 12);
52       DELETE FROM t1 WHERE a=1;
53       UPDATE t1 SET b='five', c='six' WHERE a=4;
54   }
56   set C [S changeset]
57   db eval ROLLBACK
58   S delete
59   set {} {}
60 } {}
62 do_execsql_test 2.2 {
63   CREATE TEMP TABLE t1(a INTEGER PRIMARY KEY, b, c);
64   INSERT INTO temp.t1 VALUES(1, 2, 3), (4, 5, 6), (7, 8, 9);
67 set ::conflict [list]
68 proc xConflict {args} { lappend ::conflict $args ; return "" }
69 do_test 2.3 {
70   sqlite3changeset_apply db $C xConflict
71   set ::conflict
72 } {}
73 do_execsql_test 2.4 {
74   SELECT * FROM main.t1;
75   SELECT '****';
76   SELECT * FROM temp.t1;
77 } {
78   4 five six 7 8 9 10 11 12
79   ****
80   1 2 3 4 5 6 7 8 9
84 finish_test