Documentation Source Text

Check-in [d2cf72e32f]
Login

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

Overview
Comment:Update the change log and the SQLITE_STMT documentation to reflect the new table name.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d2cf72e32fece7c767f91c04786b96bdbc335760a86011341ff6b21dfe8a041a
User & Date: drh 2017-07-14 15:38:02.267
Context
2017-07-15
15:30
Update althttpd.c to exclude HTTrack, which seems to be an abusive spider. (check-in: b47f5ff005 user: drh tags: trunk)
2017-07-14
15:38
Update the change log and the SQLITE_STMT documentation to reflect the new table name. (check-in: d2cf72e32f user: drh tags: trunk)
15:37
Expand on the documentation for Tcl method "wal_hook". (check-in: 356a4d4687 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to pages/changes.in.
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<li> Update the text of error messages returned by [sqlite3_errmsg()] for some
     error codes.
<li> Add new interfaces [sqlite3_bind_pointer()], [sqlite3_result_pointer()], and
     [sqlite3_value_pointer()].  Update the [carray(PTR,N)] and 
     [https://www.sqlite.org/src/file/ext/misc/remember.c | remember(V,PTR)]
     extensions to require the use of [sqlite3_bind_pointer()] to set their
     pointer values.
<li> Added the [STMT virtual table] extension.
<li> Added the [COMPLETION extension] - designed to suggest
     tab-completions for interactive user interfaces.
<li> Added the [sqlite3_prepare_v3()] and [sqlite3_prepare16_v3()] interfaces
     with the extra "prepFlags" parameters.
<li> Provide the [SQLITE_PREPARE_PERSISTENT] flag [sqlite3_prepare_v3()] and
     use it to limit [lookaside memory] misuse by [FTS3], [FTS5], and the
     [R-Tree extension].







|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<li> Update the text of error messages returned by [sqlite3_errmsg()] for some
     error codes.
<li> Add new interfaces [sqlite3_bind_pointer()], [sqlite3_result_pointer()], and
     [sqlite3_value_pointer()].  Update the [carray(PTR,N)] and 
     [https://www.sqlite.org/src/file/ext/misc/remember.c | remember(V,PTR)]
     extensions to require the use of [sqlite3_bind_pointer()] to set their
     pointer values.
<li> Added the [SQLITE_STMT virtual table] extension.
<li> Added the [COMPLETION extension] - designed to suggest
     tab-completions for interactive user interfaces.
<li> Added the [sqlite3_prepare_v3()] and [sqlite3_prepare16_v3()] interfaces
     with the extra "prepFlags" parameters.
<li> Provide the [SQLITE_PREPARE_PERSISTENT] flag [sqlite3_prepare_v3()] and
     use it to limit [lookaside memory] misuse by [FTS3], [FTS5], and the
     [R-Tree extension].
Changes to pages/stmt.in.
1
2
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
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
87
88
89
90
91
<title>The STMT Virtual Table</title>
<tcl>hd_keywords stmt {STMT virtual table} \
        {the STMT extension}</tcl>
<fancy_format>

<h1>Overview</h1>

<p>
The STMT extension implements an [eponymous-only virtual table] that
provides information about all [prepared statements] associated with
the [database connection].
</p>

<p>
The STMT extension is included in the [amalgamation] though it is disabled

by default.  Use the [SQLITE_ENABLE_STMTVTAB] compile-time option to enable

the STMT extension.  The STMT extension can also be loaded at run-time
by compiling the extension into a shared library or DLL using the source
code at [https://sqlite.org/src/file/ext/misc/stmt.c] and following the
instructions for how to [compile loadable extensions].
</p>

<p>
The STMT extension is enabled in default builds of the [command-line shell].


<h1>Usage</h1>

<p>
The STMT virtual table is a read-only table that can be directly queried
to access information about all prepared statements on the current database
connection.  For example:

<codeblock>
SELECT * FROM stmt;
</codeblock>

<p>
A statement such as the above can be run immediately prior to invoking
[sqlite3_close()] to confirm that all prepared statements have been 
[sqlite3_finalize|finalized] and to help identify and track down prepared
statements that have "leaked" and missed finalization.

<p>
The STMT virtual table can also be used to access performance information
about prepared statements, to aid in optimization an application.  For example,

to find out how much memory is being used by [prepared statements] that have
never been used, once could run:

<codeblock>
SELECT sum(mem) FROM stmt WHERE run=0;
</codeblock>

<h2>Columns</h2>

<p>
The columns are provided by the STMT virtual table are summarized by
the hypothetical CREATE TABLE statement show here:

<codeblock>
CREATE TABLE stmt(
  ptr    INT,     -- Numeric value of the pointer to sqlite3_stmt
  sql    TEXT,    -- Original SQL text
  ncol   INT,     -- Number of output columns
  ro     BOOLEAN, -- True for "read only" statements
  busy   BOOLEAN, -- True if the statement is current running
  nscan  INT,     -- Number of full-scan steps
  nsort  INT,     -- Number of sort operations
  naidx  INT,     -- Number of automatic index inserts
  nstep  INT,     -- Number of byte-code engine steps
  reprep INT,     -- Number of reprepare operations
  run    INT,     -- Number of times this statement has been run
  mem    INT      -- Heap memory used by this statement
);
</codeblock>

<p>Future releases may add new output columns and may change the order
of legacy columns.
Further detail about the meaning of each column in the STMT virtual
table is provided below:

<ul>
<li><p><b>ptr</b>:
The numeric value of the pointer to the [sqlite3_stmt] object.

<li><p><b>sql</b>:
The original SQL text of the prepared statement.  If the prepared
statement is compiled using the [sqlite3_prepare()] interface, then
the SQL text might not have been saved, in which case this column
will be NULL.

<li><p><b>ncol</b>:
|
|
|





|





|
>

>
|






|
>




|
|
|


|









|
|
>

|


|





|



|
<
















|



<
<
<







1
2
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
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
87
88
89
90
91
<title>The SQLITE_STMT Virtual Table</title>
<tcl>hd_keywords sqlite_stmt {SQLITE_STMT virtual table} \
        {the SQLITE_STMT extension}</tcl>
<fancy_format>

<h1>Overview</h1>

<p>
The SQLITE_STMT extension implements an [eponymous-only virtual table] that
provides information about all [prepared statements] associated with
the [database connection].
</p>

<p>
The SQLITE_STMT extension is included in the [amalgamation] though 
it is disabled
by default.  Use the [SQLITE_ENABLE_STMTVTAB] compile-time option to enable
the SQLITE_STMT extension.  The SQLITE_STMT extension can also be 
loaded at run-time
by compiling the extension into a shared library or DLL using the source
code at [https://sqlite.org/src/file/ext/misc/stmt.c] and following the
instructions for how to [compile loadable extensions].
</p>

<p>
The SQLITE_STMT extension is enabled in default builds
of the [command-line shell].

<h1>Usage</h1>

<p>
The SQLITE_STMT virtual table is a read-only table that can be directly
queried to access information about all prepared statements on the 
current database connection.  For example:

<codeblock>
SELECT * FROM sqlite_stmt;
</codeblock>

<p>
A statement such as the above can be run immediately prior to invoking
[sqlite3_close()] to confirm that all prepared statements have been 
[sqlite3_finalize|finalized] and to help identify and track down prepared
statements that have "leaked" and missed finalization.

<p>
The SQLITE_STMT virtual table can also be used to access performance
information about prepared statements, to aid in optimization an application.
For example,
to find out how much memory is being used by [prepared statements] that have
never been used, one could run:

<codeblock>
SELECT sum(mem) FROM sqlite_stmt WHERE run=0;
</codeblock>

<h2>Columns</h2>

<p>
The columns are provided by the SQLITE_STMT virtual table are summarized by
the hypothetical CREATE TABLE statement show here:

<codeblock>
CREATE TABLE sqlite_stmt(

  sql    TEXT,    -- Original SQL text
  ncol   INT,     -- Number of output columns
  ro     BOOLEAN, -- True for "read only" statements
  busy   BOOLEAN, -- True if the statement is current running
  nscan  INT,     -- Number of full-scan steps
  nsort  INT,     -- Number of sort operations
  naidx  INT,     -- Number of automatic index inserts
  nstep  INT,     -- Number of byte-code engine steps
  reprep INT,     -- Number of reprepare operations
  run    INT,     -- Number of times this statement has been run
  mem    INT      -- Heap memory used by this statement
);
</codeblock>

<p>Future releases may add new output columns and may change the order
of legacy columns.
Further detail about the meaning of each column in the SQLITE_STMT virtual
table is provided below:

<ul>



<li><p><b>sql</b>:
The original SQL text of the prepared statement.  If the prepared
statement is compiled using the [sqlite3_prepare()] interface, then
the SQL text might not have been saved, in which case this column
will be NULL.

<li><p><b>ncol</b>: