sync up our in tree sqlite with the 3.3.13 official release. Commit to follow to finish this process on the windows build.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4351 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris committed 2007-02-22 22:09:42 +00:00
1 parent 64133ab31a
commit 5791353cec
118 files changed
+15152 -1229

No files matched your search

+82 -1
View File
@@ -12,7 +12,7 @@
# focus of this file is testing the join reordering optimization
# in cases that include a LEFT JOIN.
#
# $Id: where3.test,v 1.2 2006/06/06 11:45:55 drh Exp $
# $Id: where3.test,v 1.3 2006/12/16 16:25:17 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -78,4 +78,85 @@ do_test where3-1.2 {
}
} {1 {Value for C1.1} {Value for C2.1} 2 {} {Value for C2.2} 3 {Value for C1.3} {Value for C2.3}}
# This procedure executes the SQL. Then it appends
# the ::sqlite_query_plan variable.
#
proc queryplan {sql} {
set ::sqlite_sort_count 0
set data [execsql $sql]
return [concat $data $::sqlite_query_plan]
}
# If you have a from clause of the form: A B C left join D
# then make sure the query optimizer is able to reorder the
# A B C part anyway it wants.
#
# Following the fix to ticket #1652, there was a time when
# the C table would not reorder. So the following reorderings
# were possible:
#
# A B C left join D
# B A C left join D
#
# But these reorders were not allowed
#
# C A B left join D
# A C B left join D
# C B A left join D
# B C A left join D
#
# The following tests are here to verify that the latter four
# reorderings are allowed again.
#
do_test where3-2.1 {
execsql {
CREATE TABLE tA(apk integer primary key, ax);
CREATE TABLE tB(bpk integer primary key, bx);
CREATE TABLE tC(cpk integer primary key, cx);
CREATE TABLE tD(dpk integer primary key, dx);
}
queryplan {
SELECT * FROM tA, tB, tC LEFT JOIN tD ON dpk=cx
WHERE cpk=bx AND bpk=ax
}
} {tA {} tB * tC * tD *}
do_test where3-2.2 {
queryplan {
SELECT * FROM tA, tB, tC LEFT JOIN tD ON dpk=cx
WHERE cpk=bx AND apk=bx
}
} {tB {} tA * tC * tD *}
do_test where3-2.3 {
queryplan {
SELECT * FROM tA, tB, tC LEFT JOIN tD ON dpk=cx
WHERE cpk=bx AND apk=bx
}
} {tB {} tA * tC * tD *}
do_test where3-2.4 {
queryplan {
SELECT * FROM tA, tB, tC LEFT JOIN tD ON dpk=cx
WHERE apk=cx AND bpk=ax
}
} {tC {} tA * tB * tD *}
do_test where3-2.5 {
queryplan {
SELECT * FROM tA, tB, tC LEFT JOIN tD ON dpk=cx
WHERE cpk=ax AND bpk=cx
}
} {tA {} tC * tB * tD *}
do_test where3-2.5 {
queryplan {
SELECT * FROM tA, tB, tC LEFT JOIN tD ON dpk=cx
WHERE bpk=cx AND apk=bx
}
} {tC {} tB * tA * tD *}
do_test where3-2.6 {
queryplan {
SELECT * FROM tA, tB, tC LEFT JOIN tD ON dpk=cx
WHERE cpk=bx AND apk=cx
}
} {tB {} tC * tA * tD *}
finish_test