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 #*************************************************************************
12 # Test cases for the location() function.
14 set testdir [file dirname $argv0]
15 source $testdir/tester.tcl
17 do_execsql_test func6-100 {
18 CREATE TABLE t1(a,b,c,d);
19 WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100)
20 INSERT INTO t1(a,b,c,d) SELECT printf('abc%03x',x), x, 1000-x, NULL FROM c;
22 do_execsql_test func6-110 {
23 SELECT a, typeof(location(a)) FROM t1 ORDER BY rowid LIMIT 2;
24 } {abc001 integer abc002 integer}
25 do_execsql_test func6-120 {
26 SELECT a, typeof(location(+a)) FROM t1 ORDER BY rowid LIMIT 2;
27 } {abc001 null abc002 null}
28 do_execsql_test func6-130 {
29 CREATE INDEX t1a ON t1(a);
30 SELECT a, typeof(location(a)) FROM t1 ORDER BY a LIMIT 2;
31 } {abc001 null abc002 null}
32 do_execsql_test func6-140 {
33 SELECT a, typeof(location(a)) FROM t1 NOT INDEXED ORDER BY a LIMIT 2;
34 } {abc001 integer abc002 integer}