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 # The tests in this file were used while developing the SQLite 4 code.
14 set testdir [file dirname $argv0]
15 source $testdir/tester.tcl
16 set testprefix tkt-2a5629202f
18 # This procedure executes the SQL. Then it checks to see if the OP_Sort
19 # opcode was executed. If an OP_Sort did occur, then "sort" is appended
20 # to the result. If no OP_Sort happened, then "nosort" is appended.
22 # This procedure is used to check to make sure sorting is or is not
23 # occurring as expected.
26 set data [execsql $sql]
27 if {[db status sort]} {set x sort} {set x nosort}
33 CREATE TABLE t8(b TEXT, c TEXT);
34 INSERT INTO t8 VALUES('a', 'one');
35 INSERT INTO t8 VALUES('b', 'two');
36 INSERT INTO t8 VALUES(NULL, 'three');
37 INSERT INTO t8 VALUES(NULL, 'four');
41 SELECT coalesce(b, 'null') || '/' || c FROM t8 x ORDER BY x.b, x.c
42 } {null/four null/three a/one b/two}
45 CREATE UNIQUE INDEX i1 ON t8(b);
46 SELECT coalesce(b, 'null') || '/' || c FROM t8 x ORDER BY x.b, x.c
47 } {null/four null/three a/one b/two}
51 CREATE UNIQUE INDEX i1 ON t8(b, c);
52 SELECT coalesce(b, 'null') || '/' || c FROM t8 x ORDER BY x.b, x.c
53 } {null/four null/three a/one b/two}
55 #-------------------------------------------------------------------------
59 CREATE TABLE t2(a, b NOT NULL, c);
60 CREATE UNIQUE INDEX t2ab ON t2(a, b);
61 CREATE UNIQUE INDEX t2ba ON t2(b, a);
65 cksort { SELECT * FROM t2 WHERE a = 10 ORDER BY a, b, c }
69 cksort { SELECT * FROM t2 WHERE b = 10 ORDER BY a, b, c }
73 cksort { SELECT * FROM t2 WHERE a IS NULL ORDER BY a, b, c }