Documentation Source Text

Check-in [6043714558]
Login

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

Overview
Comment:Improvements to the COMPLETION table documentation.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 60437145580252c1a4bb7390b241d2c07a58611e5ca9e52bcc15b26af6d338fd
User & Date: drh 2017-07-14 03:53:46
Context
2017-07-14
12:59
Fix the wording on a requirement about the REPLACE operation. check-in: f2f32e8bfe user: drh tags: trunk
03:53
Improvements to the COMPLETION table documentation. check-in: 6043714558 user: drh tags: trunk
2017-07-13
22:39
Fix the release date for 3.20.0. check-in: ef397e0f00 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to pages/completion.in.

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

25





26
27
28
29
30
31
32
..
50
51
52
53
54
55
56
57

 {COMPLETION table-valued function}</tcl>
<fancy_format>

<h1>Overview</h1>

<p>The COMPLETION extension implements a [table-valued function] named
"completion" that can be used to suggest completions of partially entered
words on an interactive SQL input device.  The completion table can be
used to help implement tab-completion, for example.

<h1>Details</h1>

<p>The designed query interface is:

<codeblock>
SELECT DISTINCT candidate COLLATE nocase
  FROM completion($prefix, $wholeline)
 ORDER BY 1;
</codeblock>

<p>The query above will return suggestions for the whole input word that
begins with $prefix.  The $wholeline parameter is the complete line of

input text used for context.






<p>The completion table might return the same candidate more than once, and
it will return candidates in an arbitrary order.  The DISTINCT keyword and
the ORDER BY in the sample query above are added to make the answers unique
and in lexicographical order.

<h2>Example Usage</h2>
................................................................................
be unusually efficient, so long as the response time is nearly instantaneous
in a user interface.

<p>As of this writing (2017-07-13), the completion virtual table only
looks for SQL keywords, and schema, table, and column names.  The
context contained in $wholeline is completely ignored.  Future enhancements
will try to return new completions taken from function and pragma names
and other sources, as well as consider more context.








|













|
>
|
>
>
>
>
>







 







|
>
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
..
56
57
58
59
60
61
62
63
64
 {COMPLETION table-valued function}</tcl>
<fancy_format>

<h1>Overview</h1>

<p>The COMPLETION extension implements a [table-valued function] named
"completion" that can be used to suggest completions of partially entered
words during interactive SQL input.  The completion table can be
used to help implement tab-completion, for example.

<h1>Details</h1>

<p>The designed query interface is:

<codeblock>
SELECT DISTINCT candidate COLLATE nocase
  FROM completion($prefix, $wholeline)
 ORDER BY 1;
</codeblock>

<p>The query above will return suggestions for the whole input word that
begins with $prefix.  The $wholeline parameter is all text from the beginning
of the line up to the insertion point.  The $wholeline parameter is used
for context.

<p>The $prefix parameter may be NULL, in which case the prefix is deduced
from $wholeline.  Or, the $wholeline parameter may be NULL or omitted if 
context information is unavailable or if context-aware completion is not
desired.

<p>The completion table might return the same candidate more than once, and
it will return candidates in an arbitrary order.  The DISTINCT keyword and
the ORDER BY in the sample query above are added to make the answers unique
and in lexicographical order.

<h2>Example Usage</h2>
................................................................................
be unusually efficient, so long as the response time is nearly instantaneous
in a user interface.

<p>As of this writing (2017-07-13), the completion virtual table only
looks for SQL keywords, and schema, table, and column names.  The
context contained in $wholeline is completely ignored.  Future enhancements
will try to return new completions taken from function and pragma names
and other sources, as well as consider more context.  The completion
table should be considered a work-in-progress.