1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/tkt1444.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,56 @@
1.4 +# 2005 September 19
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 +# This file implements regression tests for SQLite library.
1.15 +#
1.16 +# This file implements tests to verify that ticket #1444 has been
1.17 +# fixed.
1.18 +#
1.19 +
1.20 +set testdir [file dirname $argv0]
1.21 +source $testdir/tester.tcl
1.22 +
1.23 +ifcapable !compound||!view {
1.24 + finish_test
1.25 + return
1.26 +}
1.27 +
1.28 +# The use of a VIEW that contained an ORDER BY clause within a UNION ALL
1.29 +# was causing problems. See ticket #1444.
1.30 +#
1.31 +do_test tkt1444-1.1 {
1.32 + execsql {
1.33 + CREATE TABLE DemoTable (x INTEGER, TextKey TEXT, DKey Real);
1.34 + CREATE INDEX DemoTableIdx ON DemoTable (TextKey);
1.35 + INSERT INTO DemoTable VALUES(9,8,7);
1.36 + INSERT INTO DemoTable VALUES(1,2,3);
1.37 + CREATE VIEW DemoView AS SELECT * FROM DemoTable ORDER BY TextKey;
1.38 + SELECT * FROM DemoTable UNION ALL SELECT * FROM DemoView ORDER BY 1;
1.39 + }
1.40 +} {1 2 3.0 1 2 3.0 9 8 7.0 9 8 7.0}
1.41 +do_test tkt1444-1.2 {
1.42 + execsql {
1.43 + SELECT * FROM DemoTable UNION ALL SELECT * FROM DemoView;
1.44 + }
1.45 +} {9 8 7.0 1 2 3.0 1 2 3.0 9 8 7.0}
1.46 +do_test tkt1444-1.3 {
1.47 + execsql {
1.48 + DROP VIEW DemoView;
1.49 + CREATE VIEW DemoView AS SELECT * FROM DemoTable;
1.50 + SELECT * FROM DemoTable UNION ALL SELECT * FROM DemoView ORDER BY 1;
1.51 + }
1.52 +} {1 2 3.0 1 2 3.0 9 8 7.0 9 8 7.0}
1.53 +do_test tkt1444-1.4 {
1.54 + execsql {
1.55 + SELECT * FROM DemoTable UNION ALL SELECT * FROM DemoView;
1.56 + }
1.57 +} {9 8 7.0 1 2 3.0 9 8 7.0 1 2 3.0}
1.58 +
1.59 +finish_test