Documentation Source Text

Check-in [8ff2f2f334]
Login

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

Overview
Comment:Improvements to the built-in function lists.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8ff2f2f334e7bf7bba109f381d977ca086a6be8a54c38a3aaa906396a2598065
User & Date: drh 2020-02-10 20:43:34.527
Context
2020-02-18
20:11
Fix the multi-column list display so that it works with documents that have both main and aux outputs. (check-in: 4e47b407a1 user: drh tags: trunk)
2020-02-10
20:43
Improvements to the built-in function lists. (check-in: 8ff2f2f334 user: drh tags: trunk)
20:33
Finish splitting the lang.in source file into separate parts. (check-in: ca272c33f2 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to common_links.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
proc common_links {} {
  hd_puts \
{<ul class=nounderline>
<li> <a href="features.html">Features</a> </li>
<li> <a href="whentouse.html">When to use SQLite</a> </li>
<li> <a href="faq.html">Frequently Asked Questions</a> </li>
<li> <a href="quickstart.html">Getting Started</a> </li>
<li> <a href="chronology.html">Prior Releases</a>
<li> <a href="lang.html">SQL Syntax</a>
<ul>
<li> <a href="pragma.html#toc">Pragmas</a>
<li> <a href="lang_corefunc.html">SQL functions</a>
<li> <a href="lang_datefunc.html">Date &amp; time functions</a>
<li> <a href="lang_aggfunc.html">Aggregate functions</a>
<li> <a href="windowfunctions.html#biwinfunc">Window functions</a>
<li> <a href="json1.html">JSON functions</a>
</ul>
</li>
<li> <a href="c3ref/intro.html">C/C++ Interface Spec</a>
<ul>
<li> <a href="cintro.html">Introduction</a>













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
proc common_links {} {
  hd_puts \
{<ul class=nounderline>
<li> <a href="features.html">Features</a> </li>
<li> <a href="whentouse.html">When to use SQLite</a> </li>
<li> <a href="faq.html">Frequently Asked Questions</a> </li>
<li> <a href="quickstart.html">Getting Started</a> </li>
<li> <a href="chronology.html">Prior Releases</a>
<li> <a href="lang.html">SQL Syntax</a>
<ul>
<li> <a href="pragma.html#toc">Pragmas</a>
<li> <a href="lang_corefunc.html">SQL functions</a>
<li> <a href="lang_datefunc.html">Date &amp; time functions</a>
<li> <a href="lang_aggfunc.html#aggfunclist">Aggregate functions</a>
<li> <a href="windowfunctions.html#biwinfunc">Window functions</a>
<li> <a href="json1.html">JSON functions</a>
</ul>
</li>
<li> <a href="c3ref/intro.html">C/C++ Interface Spec</a>
<ul>
<li> <a href="cintro.html">Introduction</a>
Changes to pages/lang_aggfunc.in.
82
83
84
85
86
87
88


89
90
91
92
93
94
95
  are integers or NULL
  and an integer overflow occurs at any point during the computation.
  ^Total() never throws an integer overflow.
}
</tcl>

<fancy_format>


<tcl>
RecursiveBubbleDiagram aggregate-function-invocation
</tcl>

<p>
The aggregate functions shown below are available by default.  Additional
aggregate functions written in C may be added using the 







>
>







82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
  are integers or NULL
  and an integer overflow occurs at any point during the computation.
  ^Total() never throws an integer overflow.
}
</tcl>

<fancy_format>

<h1>Syntax</h1>
<tcl>
RecursiveBubbleDiagram aggregate-function-invocation
</tcl>

<p>
The aggregate functions shown below are available by default.  Additional
aggregate functions written in C may be added using the 
107
108
109
110
111
112
113



114
115
116
117
118
119
120
121
122
123

124


125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145

146

<tcl>hd_fragment aggfilter {FILTER clause on aggregate functions}</tcl>
<p>
If a FILTER clause is provided, then only rows for which the <i>expr</i> is
true are included in the aggregate.
</p>




<tcl>
set lx {}
foreach basesyntax [array names corefuncset] {
  foreach {syntax keywords desc} $corefuncset($basesyntax) break
  regexp {^[a-z_]+} $basesyntax fragment
  foreach coresyntax $syntax {
    lappend lx [list $fragment $coresyntax 0]
  }
}
hd_list_of_links {} 225 [lsort -index 1 $lx]




hd_putsnl "<hr class='xhr'>"
hd_putsnl "<dl>"
foreach basesyntax [lsort [array names corefuncset]] {
  foreach {syntax keywords desc} $corefuncset($basesyntax) break
  regsub -all {\s+} [string trim $syntax] {<br />} syntax
  regsub -all {\(([^*)]+)\)} $syntax {(<i>\1</i>)} syntax
  regsub -all {,} $syntax {</i>,<i>} syntax
  regsub -all {<i>\.\.\.</i>} $syntax {...} syntax
  regexp {^[a-z]+} $basesyntax fragment
  if {[llength $keywords]==0} {
    regexp {[a-z_]+} $syntax name
    hd_fragment $name *$name "${name}() SQL function"
  } else {
    set fragname [lindex $keywords 0]
    regsub -all {[^a-z]} $fragname {} fragname
    hd_fragment $fragname
    eval hd_keywords [string map {\n { }} $keywords]
  }
  hd_puts "<dt><p><b>$syntax</b></dt>"
  hd_resolve "<dd><p>$desc</dd>\n"
}

hd_putsnl "</dl>"







>
>
>










>

>
>
|
|



















>
|
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155

<tcl>hd_fragment aggfilter {FILTER clause on aggregate functions}</tcl>
<p>
If a FILTER clause is provided, then only rows for which the <i>expr</i> is
true are included in the aggregate.
</p>

<tcl>hd_fragment aggfunclist</tcl>
<h1>List of built-in aggregate functions</h1>

<tcl>
set lx {}
foreach basesyntax [array names corefuncset] {
  foreach {syntax keywords desc} $corefuncset($basesyntax) break
  regexp {^[a-z_]+} $basesyntax fragment
  foreach coresyntax $syntax {
    lappend lx [list $fragment $coresyntax 0]
  }
}
hd_list_of_links {} 225 [lsort -index 1 $lx]
</tcl>

<h1>Descriptions of built-in aggregate functions</h1>
<dl>

<tcl>
foreach basesyntax [lsort [array names corefuncset]] {
  foreach {syntax keywords desc} $corefuncset($basesyntax) break
  regsub -all {\s+} [string trim $syntax] {<br />} syntax
  regsub -all {\(([^*)]+)\)} $syntax {(<i>\1</i>)} syntax
  regsub -all {,} $syntax {</i>,<i>} syntax
  regsub -all {<i>\.\.\.</i>} $syntax {...} syntax
  regexp {^[a-z]+} $basesyntax fragment
  if {[llength $keywords]==0} {
    regexp {[a-z_]+} $syntax name
    hd_fragment $name *$name "${name}() SQL function"
  } else {
    set fragname [lindex $keywords 0]
    regsub -all {[^a-z]} $fragname {} fragname
    hd_fragment $fragname
    eval hd_keywords [string map {\n { }} $keywords]
  }
  hd_puts "<dt><p><b>$syntax</b></dt>"
  hd_resolve "<dd><p>$desc</dd>\n"
}
</tcl>
</dl>
Changes to pages/lang_corefunc.in.
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
  reversed in the like() function relative to the infix [LIKE] operator.
  X is the pattern and Y is the string to match against that pattern.
  Hence, the following expressions are equivalent:
  <blockquote><pre>
     name LIKE '%neon%'
     like('%neon%',name)
  </pre></blockquote>
  ^The [sqlite3_create_function()] interface can be used to override the
  like() function and thereby change the operation of the
  [LIKE] operator.  When overriding the like() function, it may be important
  to override both the two and three argument versions of the like() 
  function. Otherwise, different code may be called to implement the
  [LIKE] operator depending on whether or not an ESCAPE clause was 
  specified.
}







|







103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
  reversed in the like() function relative to the infix [LIKE] operator.
  X is the pattern and Y is the string to match against that pattern.
  Hence, the following expressions are equivalent:
  <blockquote><pre>
     name LIKE '%neon%'
     like('%neon%',name)
  </pre></blockquote>
  <p>^The [sqlite3_create_function()] interface can be used to override the
  like() function and thereby change the operation of the
  [LIKE] operator.  When overriding the like() function, it may be important
  to override both the two and three argument versions of the like() 
  function. Otherwise, different code may be called to implement the
  [LIKE] operator depending on whether or not an ESCAPE clause was 
  specified.
}
391
392
393
394
395
396
397


398
399
400
401
402
403
404
  [sqlite3_blob_open() | incremental BLOB I/O].
  ^This SQL function is implemented using the [sqlite3_result_zeroblob()]
  routine from the C/C++ interface.
}
</tcl>

<fancy_format>



<p>The core functions shown below are available by default. 
[datefunc | Date &amp; Time functions],
[aggfunc | aggregate functions],
[builtin window functions|window functions], and
[json1 | JSON functions] are documented separately.  An
application may define additional







>
>







391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
  [sqlite3_blob_open() | incremental BLOB I/O].
  ^This SQL function is implemented using the [sqlite3_result_zeroblob()]
  routine from the C/C++ interface.
}
</tcl>

<fancy_format>

<h1>Overview</h1>

<p>The core functions shown below are available by default. 
[datefunc | Date &amp; Time functions],
[aggfunc | aggregate functions],
[builtin window functions|window functions], and
[json1 | JSON functions] are documented separately.  An
application may define additional
412
413
414
415
416
417
418

419


420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440

441
  regexp {^[a-z_]+} $basesyntax fragment
  foreach coresyntax $syntax {
    lappend lx [list $fragment $coresyntax 0]
  }
}
hd_putsnl "<p>"
hd_list_of_links {} 300 [lsort -index 1 $lx]




hd_putsnl "<hr class='xhr'>"
hd_putsnl "<dl>"
foreach basesyntax [lsort [array names corefuncset]] {
  foreach {syntax keywords desc} $corefuncset($basesyntax) break
  regsub -all {\s+} [string trim $syntax] {<br />} syntax
  regsub -all {\(([^*)]+)\)} $syntax {(<i>\1</i>)} syntax
  regsub -all {,} $syntax {</i>,<i>} syntax
  regsub -all {<i>\.\.\.</i>} $syntax {...} syntax
  regexp {^[a-z]+} $basesyntax fragment
  if {[llength $keywords]==0} {
    regexp {[a-z_]+} $syntax name
    hd_fragment $name *$name "${name}() SQL function"
  } else {
    set fragname [lindex $keywords 0]
    regsub -all {[^a-z]} $fragname {} fragname
    hd_fragment $fragname
    eval hd_keywords [string map {\n { }} $keywords]
  }
  hd_puts "<dt><p><b>$syntax</b></dt>"
  hd_resolve "<dd><p>$desc</dd>\n"
}

hd_putsnl "</dl>"







>

>
>
|
|



















>
|
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
  regexp {^[a-z_]+} $basesyntax fragment
  foreach coresyntax $syntax {
    lappend lx [list $fragment $coresyntax 0]
  }
}
hd_putsnl "<p>"
hd_list_of_links {} 300 [lsort -index 1 $lx]
</tcl>

<h1>Descriptions of built-in scalar SQL functions</h1>
<dl>

<tcl>
foreach basesyntax [lsort [array names corefuncset]] {
  foreach {syntax keywords desc} $corefuncset($basesyntax) break
  regsub -all {\s+} [string trim $syntax] {<br />} syntax
  regsub -all {\(([^*)]+)\)} $syntax {(<i>\1</i>)} syntax
  regsub -all {,} $syntax {</i>,<i>} syntax
  regsub -all {<i>\.\.\.</i>} $syntax {...} syntax
  regexp {^[a-z]+} $basesyntax fragment
  if {[llength $keywords]==0} {
    regexp {[a-z_]+} $syntax name
    hd_fragment $name *$name "${name}() SQL function"
  } else {
    set fragname [lindex $keywords 0]
    regsub -all {[^a-z]} $fragname {} fragname
    hd_fragment $fragname
    eval hd_keywords [string map {\n { }} $keywords]
  }
  hd_puts "<dt><p><b>$syntax</b></dt>"
  hd_resolve "<dd><p>$desc</dd>\n"
}
</tcl>
</dl>