Refactor the name resolution procedures in the code generator. (CVS 5569)

FossilOrigin-Name: daf730d1defa78fb8b80a78f9108ac35a13e09f6
This commit is contained in:
drh
2008-08-20 16:35:10 +00:00
parent 260d8a6aec
commit 7d10d5a6e1
29 changed files with 2215 additions and 1674 deletions
+31 -1
View File
@@ -12,7 +12,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script is page cache subsystem.
#
# $Id: collate2.test,v 1.5 2007/02/01 23:02:46 drh Exp $
# $Id: collate2.test,v 1.6 2008/08/20 16:35:10 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -136,6 +136,26 @@ do_test collate2-1.2.3 {
ORDER BY 1, oid;
}
} {ab aB Ab AB ba bA Ba BA bb bB Bb BB}
do_test collate2-1.2.4 {
execsql {
SELECT b FROM collate2t1 WHERE b > 'aa' ORDER BY +b;
}
} {ab aB Ab AB ba bA Ba BA bb bB Bb BB}
do_test collate2-1.2.5 {
execsql {
SELECT b FROM collate2t1 WHERE a COLLATE nocase > 'aa' ORDER BY +b;
}
} {ab aB Ab AB ba bA Ba BA bb bB Bb BB}
do_test collate2-1.2.6 {
execsql {
SELECT b FROM collate2t1 WHERE b COLLATE nocase > 'aa' ORDER BY +b;
}
} {ab aB Ab AB ba bA Ba BA bb bB Bb BB}
do_test collate2-1.2.7 {
execsql {
SELECT b FROM collate2t1 WHERE c COLLATE nocase > 'aa' ORDER BY +b;
}
} {ab aB Ab AB ba bA Ba BA bb bB Bb BB}
do_test collate2-1.3 {
execsql {
SELECT c FROM collate2t1 WHERE c > 'aa' ORDER BY 1;
@@ -169,6 +189,11 @@ do_test collate2-1.5 {
SELECT b FROM collate2t1 WHERE b < 'aa' ORDER BY 1, oid;
}
} {}
do_test collate2-1.5.1 {
execsql {
SELECT b FROM collate2t1 WHERE b < 'aa' ORDER BY +b;
}
} {}
do_test collate2-1.6 {
execsql {
SELECT c FROM collate2t1 WHERE c < 'aa' ORDER BY 1;
@@ -229,6 +254,11 @@ do_test collate2-1.17 {
SELECT b FROM collate2t1 WHERE b BETWEEN 'Aa' AND 'Bb' ORDER BY 1, oid;
}
} {aa aA Aa AA ab aB Ab AB ba bA Ba BA bb bB Bb BB}
do_test collate2-1.17.1 {
execsql {
SELECT b FROM collate2t1 WHERE b BETWEEN 'Aa' AND 'Bb' ORDER BY +b;
}
} {aa aA Aa AA ab aB Ab AB ba bA Ba BA bb bB Bb BB}
do_test collate2-1.18 {
execsql {
SELECT c FROM collate2t1 WHERE c BETWEEN 'Aa' AND 'Bb' ORDER BY 1;
+4 -4
View File
@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script is page cache subsystem.
#
# $Id: collate3.test,v 1.12 2008/07/12 14:52:20 drh Exp $
# $Id: collate3.test,v 1.13 2008/08/20 16:35:10 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -292,19 +292,19 @@ do_test collate3-4.7 {
SELECT * FROM collate3t1 ORDER BY a COLLATE user_defined;
}
} {1 {no such collation sequence: user_defined}}
do_test collate3-4.8 {
do_test collate3-4.8.1 {
db collate user_defined "string compare"
catchsql {
SELECT * FROM collate3t1 ORDER BY a COLLATE user_defined;
}
} {0 {hello {}}}
do_test collate3-4.8 {
do_test collate3-4.8.2 {
db close
lindex [catch {
sqlite3 db test.db
}] 0
} {0}
do_test collate3-4.8 {
do_test collate3-4.8.3 {
execsql {
DROP TABLE collate3t1;
}
+2 -1
View File
@@ -12,7 +12,7 @@
#
# This file tests malloc failures in concert with fuzzy SQL generation.
#
# $Id: fuzz_malloc.test,v 1.9 2007/09/03 15:42:48 drh Exp $
# $Id: fuzz_malloc.test,v 1.10 2008/08/20 16:35:10 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -56,6 +56,7 @@ proc do_fuzzy_malloc_test {testname args} {
expr srand($jj)
incr jj
set ::sql [subst $::fuzzyopts(-template)]
# puts fuzyy-sql=\[$::sql\]; flush stdout
foreach {rc res} [catchsql "$::sql"] {}
if {$rc==0} {
do_malloc_test $testname-$ii -sqlbody $::sql -sqlprep $::prep
+1 -2
View File
@@ -12,7 +12,7 @@
# focus of this file is testing aggregate functions and the
# GROUP BY and HAVING clauses of SELECT statements.
#
# $Id: select5.test,v 1.18 2008/08/02 03:50:40 drh Exp $
# $Id: select5.test,v 1.19 2008/08/20 16:35:10 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -159,7 +159,6 @@ do_test select5-5.5 {
# Test rendering of columns for the GROUP BY clause.
#
do_test select5-5.11 {
breakpoint
execsql {
SELECT max(c), b*a, b, a FROM t2 GROUP BY b*a, b, a
}
+2 -2
View File
@@ -12,7 +12,7 @@
# focus of this file is testing SELECT statements that contain
# subqueries in their FROM clause.
#
# $Id: select6.test,v 1.27 2008/07/12 14:52:20 drh Exp $
# $Id: select6.test,v 1.28 2008/08/20 16:35:10 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -300,7 +300,7 @@ do_test select6-5.2 {
# Tests of compound sub-selects
#
do_test select5-6.1 {
do_test select6-6.1 {
execsql {
DELETE FROM t1 WHERE x>4;
SELECT * FROM t1
+4 -4
View File
@@ -13,7 +13,7 @@
# ORDER BY clauses on compound SELECT statements raised by ticket
# #2822 have been dealt with.
#
# $Id: tkt2822.test,v 1.5 2008/08/04 03:51:24 danielk1977 Exp $
# $Id: tkt2822.test,v 1.6 2008/08/20 16:35:10 drh Exp $
#
set testdir [file dirname $argv0]
@@ -134,12 +134,12 @@ do_test tkt2822-3.2 {
# Test that if a match cannot be found in the leftmost SELECT, an
# attempt is made to find a match in subsequent SELECT statements.
#
do_test tkt2822-3.1 {
do_test tkt2822-3.3 {
execsql {
SELECT a, b, c FROM t1 UNION ALL SELECT a AS x, b, c FROM t2 ORDER BY x;
}
} {1 3 9 2 6 18 3 9 27 4 12 36 5 15 45 6 18 54}
do_test tkt2822-3.2 {
do_test tkt2822-3.4 {
# But the leftmost SELECT takes precedence.
execsql {
SELECT a AS b, CAST (b AS TEXT) AS a, c FROM t1
@@ -148,7 +148,7 @@ do_test tkt2822-3.2 {
ORDER BY a;
}
} {2 6 18 4 12 36 6 18 54 5 15 45 1 3 9 3 9 27}
do_test tkt2822-3.3 {
do_test tkt2822-3.5 {
execsql {
SELECT a, b, c FROM t2
UNION ALL