AryaWu/sqlite
0
1# 2012 December 192#3# The author disclaims copyright to this source code. In place of4# 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. Specifically,12# it tests that ticket [a7b7803e8d1e8699cd8a460a38133b98892d2e17] has13# been fixed.14#15 16set testdir [file dirname $argv0]17source $testdir/tester.tcl18source $testdir/lock_common.tcl19source $testdir/malloc_common.tcl20 21do_test tkt-a7b7803e.1 {22 db eval {23 CREATE TABLE t1(a,b);24 INSERT INTO t1 VALUES(0,'first'),(99,'fuzzy');25 SELECT (t1.a==0) AS x, b26 FROM t127 WHERE a=0 OR x;28 }29} {1 first}30do_test tkt-a7b7803e.2 {31 db eval {32 SELECT a, (t1.b='fuzzy') AS x33 FROM t134 WHERE x35 }36} {99 1}37do_test tkt-a7b7803e.3 {38 db eval {39 SELECT (a=99) AS x, (t1.b='fuzzy') AS y, *40 FROM t141 WHERE x AND y42 }43} {1 1 99 fuzzy}44do_test tkt-a7b7803e.4 {45 db eval {46 SELECT (a=99) AS x, (t1.b='first') AS y, *47 FROM t148 WHERE x OR y49 ORDER BY a50 }51} {0 1 0 first 1 0 99 fuzzy}52do_test tkt-a7b7803e.5 {53 db eval {54 SELECT (M.a=99) AS x, M.b, (N.b='first') AS y, N.b55 FROM t1 M, t1 N56 WHERE x OR y57 ORDER BY M.a, N.a58 }59} {0 first 1 first 1 fuzzy 1 first 1 fuzzy 0 fuzzy}60do_test tkt-a7b7803e.6 {61 db eval {62 SELECT (M.a=99) AS x, M.b, (N.b='first') AS y, N.b63 FROM t1 M, t1 N64 WHERE x AND y65 ORDER BY M.a, N.a66 }67} {1 fuzzy 1 first}68do_test tkt-a7b7803e.7 {69 db eval {70 SELECT (M.a=99) AS x, M.b, (N.b='first') AS y, N.b71 FROM t1 M JOIN t1 N ON x AND y72 ORDER BY M.a, N.a73 }74} {1 fuzzy 1 first}75do_test tkt-a7b7803e.8 {76 db eval {77 SELECT (M.a=99) AS x, M.b, (N.b='first') AS y, N.b78 FROM t1 M JOIN t1 N ON x79 ORDER BY M.a, N.a80 }81} {1 fuzzy 1 first 1 fuzzy 0 fuzzy}82 83 84finish_test85 