drh | 2fc865c | 2017-12-16 20:20:37 +0000 | [diff] [blame] | 1 | # 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 | # |
drh | 092457b | 2017-12-29 15:04:49 +0000 | [diff] [blame^] | 12 | # Test cases for the sqlite_unsupported_offset() function. |
drh | 2fc865c | 2017-12-16 20:20:37 +0000 | [diff] [blame] | 13 | # |
| 14 | set testdir [file dirname $argv0] |
| 15 | source $testdir/tester.tcl |
drh | 092457b | 2017-12-29 15:04:49 +0000 | [diff] [blame^] | 16 | ifcapable !offset_sql_func { |
| 17 | finish_test |
| 18 | return |
| 19 | } |
drh | 2fc865c | 2017-12-16 20:20:37 +0000 | [diff] [blame] | 20 | |
| 21 | do_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 | } |
| 26 | do_execsql_test func6-110 { |
drh | 092457b | 2017-12-29 15:04:49 +0000 | [diff] [blame^] | 27 | SELECT a, typeof(sqlite_unsupported_offset(a)) FROM t1 |
| 28 | ORDER BY rowid LIMIT 2; |
drh | 2fc865c | 2017-12-16 20:20:37 +0000 | [diff] [blame] | 29 | } {abc001 integer abc002 integer} |
| 30 | do_execsql_test func6-120 { |
drh | 092457b | 2017-12-29 15:04:49 +0000 | [diff] [blame^] | 31 | SELECT a, typeof(sqlite_unsupported_offset(+a)) FROM t1 |
| 32 | ORDER BY rowid LIMIT 2; |
drh | 2fc865c | 2017-12-16 20:20:37 +0000 | [diff] [blame] | 33 | } {abc001 null abc002 null} |
| 34 | do_execsql_test func6-130 { |
| 35 | CREATE INDEX t1a ON t1(a); |
drh | 092457b | 2017-12-29 15:04:49 +0000 | [diff] [blame^] | 36 | SELECT a, typeof(sqlite_unsupported_offset(a)) FROM t1 |
| 37 | ORDER BY a LIMIT 2; |
drh | fe6d20e | 2017-12-29 14:33:54 +0000 | [diff] [blame] | 38 | } {abc001 integer abc002 integer} |
drh | 2fc865c | 2017-12-16 20:20:37 +0000 | [diff] [blame] | 39 | do_execsql_test func6-140 { |
drh | 092457b | 2017-12-29 15:04:49 +0000 | [diff] [blame^] | 40 | SELECT a, typeof(sqlite_unsupported_offset(a)) FROM t1 NOT INDEXED |
| 41 | ORDER BY a LIMIT 2; |
drh | 2fc865c | 2017-12-16 20:20:37 +0000 | [diff] [blame] | 42 | } {abc001 integer abc002 integer} |
| 43 | |
| 44 | finish_test |