| 1 |
# 2022 October 7 |
| 2 |
# |
| 3 |
# The author disclaims copyright to this source code. In place of |
| 4 |
# 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. |
| 12 |
# |
| 13 |
|
| 14 |
set testdir [file dirname $argv0] |
| 15 |
source $testdir/tester.tcl |
| 16 |
set testprefix seekscan1 |
| 17 |
|
| 18 |
do_execsql_test 1.0 { |
| 19 |
CREATE TABLE t1(a TEXT, b INT, c INT NOT NULL, PRIMARY KEY(a,b,c)); |
| 20 |
WITH RECURSIVE c(x) AS (VALUES(0) UNION ALL SELECT x+1 FROM c WHERE x<1997) |
| 21 |
INSERT INTO t1(a,b,c) SELECT printf('xyz%d',x/10),x/6,x FROM c; |
| 22 |
INSERT INTO t1 VALUES('abc',234,6); |
| 23 |
INSERT INTO t1 VALUES('abc',345,7); |
| 24 |
ANALYZE; |
| 25 |
} |
| 26 |
|
| 27 |
|
| 28 |
do_execsql_test 1.1 { |
| 29 |
SELECT a,b,c FROM t1 |
| 30 |
WHERE b IN (234, 345) AND c BETWEEN 6 AND 6.5 AND a='abc' |
| 31 |
ORDER BY a, b; |
| 32 |
} { |
| 33 |
abc 234 6 |
| 34 |
} |
| 35 |
|
| 36 |
do_execsql_test 1.2 { |
| 37 |
SELECT a,b,c FROM t1 |
| 38 |
WHERE b IN (234, 345) AND c BETWEEN 6 AND 7 AND a='abc' |
| 39 |
ORDER BY a, b; |
| 40 |
} { |
| 41 |
abc 234 6 |
| 42 |
abc 345 7 |
| 43 |
} |
| 44 |
|
| 45 |
do_execsql_test 1.3 { |
| 46 |
SELECT a,b,c FROM t1 |
| 47 |
WHERE b IN (234, 345) AND c >=6 AND a='abc' |
| 48 |
ORDER BY a, b; |
| 49 |
} { |
| 50 |
abc 234 6 |
| 51 |
abc 345 7 |
| 52 |
} |
| 53 |
|
| 54 |
do_execsql_test 1.4 { |
| 55 |
SELECT a,b,c FROM t1 |
| 56 |
WHERE b IN (234, 345) AND c<=7 AND a='abc' |
| 57 |
ORDER BY a, b; |
| 58 |
} { |
| 59 |
abc 234 6 |
| 60 |
abc 345 7 |
| 61 |
} |
| 62 |
|
| 63 |
do_execsql_test 1.5 { |
| 64 |
SELECT a,b,c FROM t1 WHERE b IN (235, 345) AND c<=3 AND a='abc' ORDER BY a, b; |
| 65 |
} |
| 66 |
|
| 67 |
|
| 68 |
finish_test |