blob: ff05ee78c5927520e9a12f821ea10fc7c9d283e6 [file] [log] [blame]
drh2fc865c2017-12-16 20:20:37 +00001# 2017-12-16
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#
drh092457b2017-12-29 15:04:49 +000012# Test cases for the sqlite_unsupported_offset() function.
drh2fc865c2017-12-16 20:20:37 +000013#
14set testdir [file dirname $argv0]
15source $testdir/tester.tcl
drh092457b2017-12-29 15:04:49 +000016ifcapable !offset_sql_func {
17 finish_test
18 return
19}
drh2fc865c2017-12-16 20:20:37 +000020
21do_execsql_test func6-100 {
22 CREATE TABLE t1(a,b,c,d);
23 WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100)
24 INSERT INTO t1(a,b,c,d) SELECT printf('abc%03x',x), x, 1000-x, NULL FROM c;
25}
26do_execsql_test func6-110 {
drh092457b2017-12-29 15:04:49 +000027 SELECT a, typeof(sqlite_unsupported_offset(a)) FROM t1
28 ORDER BY rowid LIMIT 2;
drh2fc865c2017-12-16 20:20:37 +000029} {abc001 integer abc002 integer}
30do_execsql_test func6-120 {
drh092457b2017-12-29 15:04:49 +000031 SELECT a, typeof(sqlite_unsupported_offset(+a)) FROM t1
32 ORDER BY rowid LIMIT 2;
drh2fc865c2017-12-16 20:20:37 +000033} {abc001 null abc002 null}
34do_execsql_test func6-130 {
35 CREATE INDEX t1a ON t1(a);
drh092457b2017-12-29 15:04:49 +000036 SELECT a, typeof(sqlite_unsupported_offset(a)) FROM t1
37 ORDER BY a LIMIT 2;
drhfe6d20e2017-12-29 14:33:54 +000038} {abc001 integer abc002 integer}
drh2fc865c2017-12-16 20:20:37 +000039do_execsql_test func6-140 {
drh092457b2017-12-29 15:04:49 +000040 SELECT a, typeof(sqlite_unsupported_offset(a)) FROM t1 NOT INDEXED
41 ORDER BY a LIMIT 2;
drh2fc865c2017-12-16 20:20:37 +000042} {abc001 integer abc002 integer}
43
44finish_test