1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/tkt3334.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,84 @@
1.4 +# 2008 August 26
1.5 +#
1.6 +# The author disclaims copyright to this source code. In place of
1.7 +# a legal notice, here is a blessing:
1.8 +#
1.9 +# May you do good and not evil.
1.10 +# May you find forgiveness for yourself and forgive others.
1.11 +# May you share freely, never taking more than you give.
1.12 +#
1.13 +#***********************************************************************
1.14 +#
1.15 +# This file implements regression tests for SQLite library.
1.16 +# Specifically, it tests that bug #3334 has been fixed by the
1.17 +# addition of restriction (19) to the subquery flattener optimization.
1.18 +#
1.19 +# $Id: tkt3334.test,v 1.1 2008/08/26 12:56:14 drh Exp $
1.20 +
1.21 +
1.22 +set testdir [file dirname $argv0]
1.23 +source $testdir/tester.tcl
1.24 +
1.25 +do_test tkt3334-1.0 {
1.26 + execsql {
1.27 + CREATE TABLE t1(a,b);
1.28 + INSERT INTO t1 VALUES(1,934);
1.29 + INSERT INTO t1 VALUES(2,221);
1.30 + INSERT INTO t1 VALUES(1,372);
1.31 + INSERT INTO t1 VALUES(3,552);
1.32 + INSERT INTO t1 VALUES(1,719);
1.33 + INSERT INTO t1 VALUES(4,102);
1.34 + SELECT * FROM t1 ORDER BY b;
1.35 + }
1.36 +} {4 102 2 221 1 372 3 552 1 719 1 934}
1.37 +
1.38 +do_test tkt3334-1.1 {
1.39 + execsql {
1.40 + SELECT a FROM (SELECT a FROM t1 ORDER BY b LIMIT 2) WHERE a=1;
1.41 + }
1.42 +} {}
1.43 +do_test tkt3334-1.2 {
1.44 + execsql {
1.45 + SELECT count(*) FROM (SELECT a FROM t1 ORDER BY b LIMIT 2) WHERE a=1;
1.46 + }
1.47 +} {0}
1.48 +do_test tkt3334-1.3 {
1.49 + execsql {
1.50 + SELECT a FROM (SELECT a FROM t1 ORDER BY b LIMIT 3) WHERE a=1;
1.51 + }
1.52 +} {1}
1.53 +do_test tkt3334-1.4 {
1.54 + execsql {
1.55 + SELECT count(*) FROM (SELECT a FROM t1 ORDER BY b LIMIT 3) WHERE a=1;
1.56 + }
1.57 +} {1}
1.58 +do_test tkt3334-1.5 {
1.59 + execsql {
1.60 + SELECT a FROM (SELECT a FROM t1 ORDER BY b LIMIT 99) WHERE a=1;
1.61 + }
1.62 +} {1 1 1}
1.63 +do_test tkt3334-1.6 {
1.64 + execsql {
1.65 + SELECT count(*) FROM (SELECT a FROM t1 ORDER BY b LIMIT 99) WHERE a=1;
1.66 + }
1.67 +} {3}
1.68 +do_test tkt3334-1.7 {
1.69 + execsql {
1.70 + SELECT a FROM (SELECT a FROM t1 ORDER BY b) WHERE a=1;
1.71 + }
1.72 +} {1 1 1}
1.73 +do_test tkt3334-1.8 {
1.74 + execsql {
1.75 + SELECT count(*) FROM (SELECT a FROM t1 ORDER BY b) WHERE a=1;
1.76 + }
1.77 +} {3}
1.78 +do_test tkt3334-1.9 {
1.79 + execsql {
1.80 + SELECT a FROM (SELECT a FROM t1) WHERE a=1;
1.81 + }
1.82 +} {1 1 1}
1.83 +do_test tkt3334-1.10 {
1.84 + execsql {
1.85 + SELECT count(*) FROM (SELECT a FROM t1) WHERE a=1;
1.86 + }
1.87 +} {3}