CoolFace
Modelpublic

AryaWu/sqlite

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
sorterref.test57 linesDownload Raw Back to test
1# 2018 April 14.2#3# The author disclaims copyright to this source code.  In place of4# a legal notice, here is a blessing:5#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.9#10#***********************************************************************11#12 13set testdir [file dirname $argv0]14source $testdir/tester.tcl15set testprefix sorterref16 17# If SQLITE_OMIT_ALTERTABLE is defined, omit this file.18ifcapable !altertable {19  finish_test20  return21}22 23do_execsql_test 1.0 {24  CREATE TABLE t1(a, b, c);25  INSERT INTO t1 VALUES(1, 2, 3);26  INSERT INTO t1 VALUES(4, 5, 6);27  ALTER TABLE t1 ADD COLUMN d DEFAULT 'string';28  INSERT INTO t1 VALUES(7, 8, 9, 'text');29}30 31do_execsql_test 1.1 {32  SELECT * FROM t1 ORDER BY b;33} {34  1 2 3 string 4 5 6 string 7 8 9 text35}36 37do_execsql_test 2.0 {38  DROP TABLE IF EXISTS t1;39  CREATE TABLE t1(a, b);40  CREATE TABLE t2(c, d, PRIMARY KEY(c)) WITHOUT ROWID;41 42  INSERT INTO t1 VALUES(1, 2);43  INSERT INTO t1 VALUES(2, 3);44  INSERT INTO t1 VALUES(3, 4);45 46  INSERT INTO t2 VALUES(1, 'one');47  INSERT INTO t2 VALUES(3, 'three');48}49 50do_execsql_test 2.1 {51  SELECT * FROM t1 LEFT JOIN t2 ON (a=c) ORDER BY b;52} {1 2 1 one 2 3 {} {} 3 4 3 three}53 54 55 56finish_test57