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 # Quick tests for the sqldiff tool
14 set testdir [file dirname $argv0]
15 source $testdir/tester.tcl
17 set PROG [test_find_sqldiff]
20 forcedelete test.db test2.db
25 CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
26 CREATE TABLE t2(a INT PRIMARY KEY, b) WITHOUT ROWID;
27 WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100)
28 INSERT INTO t1(a,b) SELECT x, printf('abc-%d-xyz',x) FROM c;
29 INSERT INTO t2(a,b) SELECT a, b FROM t1;
33 ATTACH 'test2.db' AS x2;
34 DELETE FROM x2.t1 WHERE a=49;
35 DELETE FROM x2.t2 WHERE a=48;
36 INSERT INTO x2.t1(a,b) VALUES(1234,'hello');
37 INSERT INTO x2.t2(a,b) VALUES(50.5,'xyzzy');
38 CREATE TABLE x2.t3(a,b,c);
39 INSERT INTO x2.t3 VALUES(111,222,333);
40 CREATE TABLE main.t4(x,y,z);
41 INSERT INTO t4 SELECT * FROM t3;
43 set line "exec $PROG test.db test2.db"
44 unset -nocomplain ::MSG
45 catch {eval $line} ::MSG
49 } {DELETE FROM t1 WHERE a=49;
50 INSERT INTO t1(a,b) VALUES(1234,'hello');
51 DELETE FROM t2 WHERE a=48;
52 INSERT INTO t2(a,b) VALUES(50.5,'xyzzy');
53 CREATE TABLE t3(a,b,c);
54 INSERT INTO t3(rowid,a,b,c) VALUES(1,111,222,333);