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 left outer joins containing WHERE
2N/A# clauses that restrict the scope of the left term of the join.
2N/A#
2N/A# $Id: join4_28.test,v 1.1.2.1 2004/07/22 16:08:39 drh Exp $
2N/A
2N/Aset testdir [file dirname $argv0]
2N/Asource $testdir/tester.tcl
2N/A
2N/Ado_test join4-1.1 {
2N/A execsql {
2N/A create temp table t1(a integer, b varchar(10));
2N/A insert into t1 values(1,'one');
2N/A insert into t1 values(2,'two');
2N/A insert into t1 values(3,'three');
2N/A insert into t1 values(4,'four');
2N/A
2N/A create temp table t2(x integer, y varchar(10), z varchar(10));
2N/A insert into t2 values(2,'niban','ok');
2N/A insert into t2 values(4,'yonban','err');
2N/A }
2N/A execsql {
2N/A select * from t1 left outer join t2 on t1.a=t2.x where t2.z='ok'
2N/A }
2N/A} {2 two 2 niban ok}
2N/Ado_test join4-1.2 {
2N/A execsql {
2N/A select * from t1 left outer join t2 on t1.a=t2.x and t2.z='ok'
2N/A }
2N/A} {1 one {} {} {} 2 two 2 niban ok 3 three {} {} {} 4 four {} {} {}}
2N/Ado_test join4-1.3 {
2N/A execsql {
2N/A create index i2 on t2(z);
2N/A }
2N/A execsql {
2N/A select * from t1 left outer join t2 on t1.a=t2.x where t2.z='ok'
2N/A }
2N/A} {2 two 2 niban ok}
2N/Ado_test join4-1.4 {
2N/A execsql {
2N/A select * from t1 left outer join t2 on t1.a=t2.x and t2.z='ok'
2N/A }
2N/A} {1 one {} {} {} 2 two 2 niban ok 3 three {} {} {} 4 four {} {} {}}
2N/Ado_test join4-1.5 {
2N/A execsql {
2N/A select * from t1 left outer join t2 on t1.a=t2.x where t2.z>='ok'
2N/A }
2N/A} {2 two 2 niban ok}
2N/Ado_test join4-1.4 {
2N/A execsql {
2N/A select * from t1 left outer join t2 on t1.a=t2.x and t2.z>='ok'
2N/A }
2N/A} {1 one {} {} {} 2 two 2 niban ok 3 three {} {} {} 4 four {} {} {}}
2N/Ado_test join4-1.6 {
2N/A execsql {
2N/A select * from t1 left outer join t2 on t1.a=t2.x where t2.z IN ('ok')
2N/A }
2N/A} {2 two 2 niban ok}
2N/Ado_test join4-1.7 {
2N/A execsql {
2N/A select * from t1 left outer join t2 on t1.a=t2.x and t2.z IN ('ok')
2N/A }
2N/A} {1 one {} {} {} 2 two 2 niban ok 3 three {} {} {} 4 four {} {} {}}
2N/A
2N/A
2N/Afinish_test