2fc865c115
location of the payload within the database for the record that contains column X. location(X) returns NULL if X is not an ordinary table column or if SQLite cannot figure out the location because it is using a covering index. FossilOrigin-Name: 51be9558164301c5dd4df23ab8b3e67de0b522f8d36f79f3d84d45d3dc2a83a4
37 lines
1.2 KiB
Plaintext
37 lines
1.2 KiB
Plaintext
# 2017-12-16
|
|
#
|
|
# The author disclaims copyright to this source code. In place of
|
|
# a legal notice, here is a blessing:
|
|
#
|
|
# May you do good and not evil.
|
|
# May you find forgiveness for yourself and forgive others.
|
|
# May you share freely, never taking more than you give.
|
|
#
|
|
#*************************************************************************
|
|
#
|
|
# Test cases for the location() function.
|
|
#
|
|
set testdir [file dirname $argv0]
|
|
source $testdir/tester.tcl
|
|
|
|
do_execsql_test func6-100 {
|
|
CREATE TABLE t1(a,b,c,d);
|
|
WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100)
|
|
INSERT INTO t1(a,b,c,d) SELECT printf('abc%03x',x), x, 1000-x, NULL FROM c;
|
|
}
|
|
do_execsql_test func6-110 {
|
|
SELECT a, typeof(location(a)) FROM t1 ORDER BY rowid LIMIT 2;
|
|
} {abc001 integer abc002 integer}
|
|
do_execsql_test func6-120 {
|
|
SELECT a, typeof(location(+a)) FROM t1 ORDER BY rowid LIMIT 2;
|
|
} {abc001 null abc002 null}
|
|
do_execsql_test func6-130 {
|
|
CREATE INDEX t1a ON t1(a);
|
|
SELECT a, typeof(location(a)) FROM t1 ORDER BY a LIMIT 2;
|
|
} {abc001 null abc002 null}
|
|
do_execsql_test func6-140 {
|
|
SELECT a, typeof(location(a)) FROM t1 NOT INDEXED ORDER BY a LIMIT 2;
|
|
} {abc001 integer abc002 integer}
|
|
|
|
finish_test
|