3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
11 # Tests focused on the "constant propagation" that occurs within the
12 # WHERE clause of a SELECT statemente.
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
17 source $testdir/malloc_common.tcl
22 CREATE TABLE t1(a, b INTEGER, c TEXT, d REAL, e BLOB);
23 INSERT INTO t1 VALUES(10.0, 10.0, 10.0, 10.0, 10.0);
26 10.0 10 10.0 10.0 10.0
29 do_execsql_test 1.1.1 {
30 SELECT a=10, a = '10.0', a LIKE '10.0' FROM t1;
32 do_execsql_test 1.1.2 {
33 SELECT count(*) FROM t1 WHERE a=10 AND a = '10.0'
35 do_execsql_test 1.1.3 {
36 SELECT count(*) FROM t1 WHERE a=10 AND a LIKE '10.0'
38 do_execsql_test 1.1.4 {
39 SELECT count(*) FROM t1 WHERE a='10.0' AND a LIKE '10.0'
42 do_execsql_test 1.2.1 {
43 SELECT b=10, b = '10.0', b LIKE '10.0', b LIKE '10' FROM t1;
45 do_execsql_test 1.2.2 {
46 SELECT count(*) FROM t1 WHERE b=10 AND b = '10.0'
48 do_execsql_test 1.2.3 {
49 SELECT count(*) FROM t1 WHERE b=10 AND b LIKE '10.0'
51 do_execsql_test 1.2.4 {
52 SELECT count(*) FROM t1 WHERE b='10.0' AND b LIKE '10.0'
54 do_execsql_test 1.2.3 {
55 SELECT count(*) FROM t1 WHERE b=10 AND b LIKE '10'
57 do_execsql_test 1.2.4 {
58 SELECT count(*) FROM t1 WHERE b='10.0' AND b LIKE '10'
61 do_execsql_test 1.3.1 {
62 SELECT c=10, c = 10.0, c = '10.0', c LIKE '10.0' FROM t1;
64 do_execsql_test 1.3.2 {
65 SELECT count(*) FROM t1 WHERE c=10 AND c = '10.0'
67 do_execsql_test 1.3.3 {
68 SELECT count(*) FROM t1 WHERE c=10 AND c LIKE '10.0'
70 do_execsql_test 1.3.4 {
71 SELECT count(*) FROM t1 WHERE c='10.0' AND c LIKE '10.0'
73 do_execsql_test 1.3.5 {
74 SELECT count(*) FROM t1 WHERE c=10.0 AND c = '10.0'
76 do_execsql_test 1.3.6 {
77 SELECT count(*) FROM t1 WHERE c=10.0 AND c LIKE '10.0'
80 do_execsql_test 1.4.1 {
81 SELECT d=10, d = 10.0, d = '10.0', d LIKE '10.0', d LIKE '10' FROM t1;
83 do_execsql_test 1.4.2 {
84 SELECT count(*) FROM t1 WHERE d=10 AND d = '10.0'
86 do_execsql_test 1.4.3 {
87 SELECT count(*) FROM t1 WHERE d=10 AND d LIKE '10.0'
89 do_execsql_test 1.4.4 {
90 SELECT count(*) FROM t1 WHERE d='10.0' AND d LIKE '10.0'
92 do_execsql_test 1.4.5 {
93 SELECT count(*) FROM t1 WHERE d='10' AND d LIKE '10.0'
96 do_execsql_test 1.5.1 {
97 SELECT e=10, e = '10.0', e LIKE '10.0', e LIKE '10' FROM t1;
99 do_execsql_test 1.5.2 {
100 SELECT count(*) FROM t1 WHERE e=10 AND e = '10.0'
102 do_execsql_test 1.5.3 {
103 SELECT count(*) FROM t1 WHERE e=10 AND e LIKE '10.0'
105 do_execsql_test 1.5.4 {
106 SELECT count(*) FROM t1 WHERE e='10.0' AND e LIKE '10.0'
108 do_execsql_test 1.5.5 {
109 SELECT count(*) FROM t1 WHERE e=10.0 AND e LIKE '10.0'