2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A# 2002 May 24
2N/A#
2N/A# The author disclaims copyright to this source code. In place of
2N/A# a legal notice, here is a blessing:
2N/A#
2N/A# May you do good and not evil.
2N/A# May you find forgiveness for yourself and forgive others.
2N/A# May you share freely, never taking more than you give.
2N/A#
2N/A#***********************************************************************
2N/A# This file implements regression tests for SQLite library.
2N/A#
2N/A# This file implements tests for joins, including outer joins.
2N/A#
2N/A# $Id: join2.test,v 1.1 2004/01/24 20:18:13 drh Exp $
2N/A
2N/Aset testdir [file dirname $argv0]
2N/Asource $testdir/tester.tcl
2N/A
2N/Ado_test join2-1.1 {
2N/A execsql {
2N/A CREATE TABLE t1(a,b);
2N/A INSERT INTO t1 VALUES(1,11);
2N/A INSERT INTO t1 VALUES(2,22);
2N/A INSERT INTO t1 VALUES(3,33);
2N/A SELECT * FROM t1;
2N/A }
2N/A} {1 11 2 22 3 33}
2N/Ado_test join2-1.2 {
2N/A execsql {
2N/A CREATE TABLE t2(b,c);
2N/A INSERT INTO t2 VALUES(11,111);
2N/A INSERT INTO t2 VALUES(33,333);
2N/A INSERT INTO t2 VALUES(44,444);
2N/A SELECT * FROM t2;
2N/A }
2N/A} {11 111 33 333 44 444};
2N/Ado_test join2-1.3 {
2N/A execsql {
2N/A CREATE TABLE t3(c,d);
2N/A INSERT INTO t3 VALUES(111,1111);
2N/A INSERT INTO t3 VALUES(444,4444);
2N/A INSERT INTO t3 VALUES(555,5555);
2N/A SELECT * FROM t3;
2N/A }
2N/A} {111 1111 444 4444 555 5555}
2N/A
2N/Ado_test join2-1.4 {
2N/A execsql {
2N/A SELECT * FROM
2N/A t1 NATURAL JOIN t2 NATURAL JOIN t3
2N/A }
2N/A} {1 11 111 1111}
2N/Ado_test join2-1.5 {
2N/A execsql {
2N/A SELECT * FROM
2N/A t1 NATURAL JOIN t2 NATURAL LEFT OUTER JOIN t3
2N/A }
2N/A} {1 11 111 1111 3 33 333 {}}
2N/Ado_test join2-1.6 {
2N/A execsql {
2N/A SELECT * FROM
2N/A t1 NATURAL LEFT OUTER JOIN t2 NATURAL JOIN t3
2N/A }
2N/A} {1 11 111 1111}
2N/Ado_test join2-1.6 {
2N/A execsql {
2N/A SELECT * FROM
2N/A t1 NATURAL LEFT OUTER JOIN (t2 NATURAL JOIN t3)
2N/A }
2N/A} {1 11 111 1111 2 22 {} {} 3 33 {} {}}
2N/A
2N/Afinish_test