SQLite

Check-in [a6eee0fcd8]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Remove the snarky "_supported_" qualifier from the name of the sqlite_offset() SQL function.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a6eee0fcd89d3958f8720ebdb5f0a8558b4795d747128091dae283eb81c4f74f
User & Date: drh 2018-01-04 19:20:37.203
Context
2018-01-05
07:57
Fix an LSM crash that could occur if LSM_CONFIG_AUTOFLUSH was set to 0. (check-in: 05346f83d5 user: dan tags: trunk)
2018-01-04
19:54
Merge in all recent trunk enhancements. (check-in: 406f791837 user: drh tags: sqlar-shell-support)
19:20
Remove the snarky "_supported_" qualifier from the name of the sqlite_offset() SQL function. (check-in: a6eee0fcd8 user: drh tags: trunk)
16:40
Fix a broken documentation hyperlink. No code changes. (check-in: d91e3f3d34 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/func.c.
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
    FUNCTION2(unlikely,          1, 0, 0, noopFunc,  SQLITE_FUNC_UNLIKELY),
    FUNCTION2(likelihood,        2, 0, 0, noopFunc,  SQLITE_FUNC_UNLIKELY),
    FUNCTION2(likely,            1, 0, 0, noopFunc,  SQLITE_FUNC_UNLIKELY),
#ifdef SQLITE_DEBUG
    FUNCTION2(affinity,          1, 0, 0, noopFunc,  SQLITE_FUNC_AFFINITY),
#endif
#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC
    FUNCTION2(sqlite_unsupported_offset,
                                 1, 0, 0, noopFunc,  SQLITE_FUNC_OFFSET|
                                                     SQLITE_FUNC_TYPEOF),
#endif
    FUNCTION(ltrim,              1, 1, 0, trimFunc         ),
    FUNCTION(ltrim,              2, 1, 0, trimFunc         ),
    FUNCTION(rtrim,              1, 2, 0, trimFunc         ),
    FUNCTION(rtrim,              2, 2, 0, trimFunc         ),
    FUNCTION(trim,               1, 3, 0, trimFunc         ),







<
|







1796
1797
1798
1799
1800
1801
1802

1803
1804
1805
1806
1807
1808
1809
1810
    FUNCTION2(unlikely,          1, 0, 0, noopFunc,  SQLITE_FUNC_UNLIKELY),
    FUNCTION2(likelihood,        2, 0, 0, noopFunc,  SQLITE_FUNC_UNLIKELY),
    FUNCTION2(likely,            1, 0, 0, noopFunc,  SQLITE_FUNC_UNLIKELY),
#ifdef SQLITE_DEBUG
    FUNCTION2(affinity,          1, 0, 0, noopFunc,  SQLITE_FUNC_AFFINITY),
#endif
#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC

    FUNCTION2(sqlite_offset,     1, 0, 0, noopFunc,  SQLITE_FUNC_OFFSET|
                                                     SQLITE_FUNC_TYPEOF),
#endif
    FUNCTION(ltrim,              1, 1, 0, trimFunc         ),
    FUNCTION(ltrim,              2, 1, 0, trimFunc         ),
    FUNCTION(rtrim,              1, 2, 0, trimFunc         ),
    FUNCTION(rtrim,              2, 2, 0, trimFunc         ),
    FUNCTION(trim,               1, 3, 0, trimFunc         ),
Changes to test/func6.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 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 sqlite_unsupported_offset() function.
#
# Some of the tests in this file depend on the exact placement of content
# within b-tree pages.  Such placement is at the implementations discretion,
# and so it is possible for results to change from one release to the next.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 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 sqlite_offset() function.
#
# Some of the tests in this file depend on the exact placement of content
# within b-tree pages.  Such placement is at the implementations discretion,
# and so it is possible for results to change from one release to the next.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
   INSERT INTO t1(a,b,c,d) SELECT printf('abc%03x',x), x, 1000-x, NULL FROM c;
  CREATE INDEX t1a ON t1(a);
  CREATE INDEX t1bc ON t1(b,c);
  CREATE TABLE t2(x TEXT PRIMARY KEY, y) WITHOUT ROWID;
  INSERT INTO t2(x,y) SELECT a, b FROM t1;
}
do_execsql_test func6-110 {
  SELECT a, sqlite_unsupported_offset(d)/4096 + 1,
            sqlite_unsupported_offset(d)%4096 FROM t1
   ORDER BY rowid LIMIT 2;
} {abc001 2 4084 abc002 2 4069}
do_execsql_test func6-120 {
  SELECT a, typeof(sqlite_unsupported_offset(+a)) FROM t1
   ORDER BY rowid LIMIT 2;
} {abc001 null abc002 null}
do_execsql_test func6-130 {
  SELECT a, sqlite_unsupported_offset(a)/4096+1, 
         sqlite_unsupported_offset(a)%4096
   FROM t1
   ORDER BY a LIMIT 2;
} {abc001 3 4087 abc002 3 4076}
do_execsql_test func6-140 {
  SELECT a, sqlite_unsupported_offset(d)/4096+1, 
         sqlite_unsupported_offset(d)%4096
   FROM t1
   ORDER BY a LIMIT 2;
} {abc001 2 4084 abc002 2 4069}
do_execsql_test func6-150 {
  SELECT a,
         sqlite_unsupported_offset(a)/4096+1, 
         sqlite_unsupported_offset(a)%4096,
         sqlite_unsupported_offset(d)/4096+1, 
         sqlite_unsupported_offset(d)%4096
   FROM t1
   ORDER BY a LIMIT 2;
} {abc001 3 4087 2 4084 abc002 3 4076 2 4069}
do_execsql_test func6-160 {
  SELECT b,
         sqlite_unsupported_offset(b)/4096+1, 
         sqlite_unsupported_offset(b)%4096,
         sqlite_unsupported_offset(c)/4096+1, 
         sqlite_unsupported_offset(c)%4096,
         sqlite_unsupported_offset(d)/4096+1, 
         sqlite_unsupported_offset(d)%4096
   FROM t1
   ORDER BY b LIMIT 2;
} {1 4 4090 4 4090 2 4084 2 4 4081 4 4081 2 4069}


do_execsql_test func6-200 {
  SELECT y, sqlite_unsupported_offset(y)/4096+1,
         sqlite_unsupported_offset(y)%4096
   FROM t2
   ORDER BY x LIMIT 2;
} {1 5 4087 2 5 4076}

finish_test







|
|



|



|
|




|
|





|
|
|
|





|
|
|
|
|
|






|
|





30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
   INSERT INTO t1(a,b,c,d) SELECT printf('abc%03x',x), x, 1000-x, NULL FROM c;
  CREATE INDEX t1a ON t1(a);
  CREATE INDEX t1bc ON t1(b,c);
  CREATE TABLE t2(x TEXT PRIMARY KEY, y) WITHOUT ROWID;
  INSERT INTO t2(x,y) SELECT a, b FROM t1;
}
do_execsql_test func6-110 {
  SELECT a, sqlite_offset(d)/4096 + 1,
            sqlite_offset(d)%4096 FROM t1
   ORDER BY rowid LIMIT 2;
} {abc001 2 4084 abc002 2 4069}
do_execsql_test func6-120 {
  SELECT a, typeof(sqlite_offset(+a)) FROM t1
   ORDER BY rowid LIMIT 2;
} {abc001 null abc002 null}
do_execsql_test func6-130 {
  SELECT a, sqlite_offset(a)/4096+1, 
         sqlite_offset(a)%4096
   FROM t1
   ORDER BY a LIMIT 2;
} {abc001 3 4087 abc002 3 4076}
do_execsql_test func6-140 {
  SELECT a, sqlite_offset(d)/4096+1, 
         sqlite_offset(d)%4096
   FROM t1
   ORDER BY a LIMIT 2;
} {abc001 2 4084 abc002 2 4069}
do_execsql_test func6-150 {
  SELECT a,
         sqlite_offset(a)/4096+1, 
         sqlite_offset(a)%4096,
         sqlite_offset(d)/4096+1, 
         sqlite_offset(d)%4096
   FROM t1
   ORDER BY a LIMIT 2;
} {abc001 3 4087 2 4084 abc002 3 4076 2 4069}
do_execsql_test func6-160 {
  SELECT b,
         sqlite_offset(b)/4096+1, 
         sqlite_offset(b)%4096,
         sqlite_offset(c)/4096+1, 
         sqlite_offset(c)%4096,
         sqlite_offset(d)/4096+1, 
         sqlite_offset(d)%4096
   FROM t1
   ORDER BY b LIMIT 2;
} {1 4 4090 4 4090 2 4084 2 4 4081 4 4081 2 4069}


do_execsql_test func6-200 {
  SELECT y, sqlite_offset(y)/4096+1,
         sqlite_offset(y)%4096
   FROM t2
   ORDER BY x LIMIT 2;
} {1 5 4087 2 5 4076}

finish_test