1# 2002 May 24 2# 3# The author disclaims copyright to this source code. In place of 4# 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# This file implements regression tests for SQLite library. 12# 13# This file implements tests for joins, including outer joins, where 14# there are a large number of tables involved in the join. 15# 16# $Id: join3.test,v 1.2 2004/07/19 17:25:25 drh Exp $ 17 18set testdir [file dirname $argv0] 19source $testdir/tester.tcl 20 21# An unrestricted join 22# 23set result {} 24for {set N 1} {$N<=40} {incr N} { 25 lappend result $N 26 do_test join3-1.$N { 27 execsql "CREATE TABLE t${N}(x);" 28 execsql "INSERT INTO t$N VALUES($N)" 29 set sql "SELECT * FROM t1" 30 for {set i 2} {$i<=$N} {incr i} {append sql ", t$i"} 31 execsql $sql 32 } $result 33} 34 35# Joins with a comparison 36# 37set result {} 38for {set N 1} {$N<=40} {incr N} { 39 lappend result $N 40 do_test join3-2.$N { 41 set sql "SELECT * FROM t1" 42 for {set i 2} {$i<=$N} {incr i} {append sql ", t$i"} 43 set sep WHERE 44 for {set i 1} {$i<$N} {incr i} { 45 append sql " $sep t[expr {$i+1}].x==t$i.x+1" 46 set sep AND 47 } 48 execsql $sql 49 } $result 50} 51 52finish_test 53