Documentation Source Text

Check-in [60e2c7225d]
Login

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

Overview
Comment:Fix formatting on the CVS virtual table documentation.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 60e2c7225dab1f5dace8f36c0d0812efa612b7a9
User & Date: drh 2016-07-13 01:00:55.883
Context
2016-07-13
11:59
Add a link to vfsstat.c in the change log. (check-in: 234e53bfcb user: drh tags: trunk)
01:00
Fix formatting on the CVS virtual table documentation. (check-in: 60e2c7225d user: drh tags: trunk)
00:55
Improvements to the carray() function documentation. (check-in: 3f0e846a97 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to pages/csv.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
<title>The DBSTAT Virtual Table</title>
<tcl>hd_keywords csv {CSV virtual table}</tcl>

<table_of_contents>
<h1>The CSV Virtual Table</h1>

<p>
The CSV virtual table reads
[https://www.ietf.org/rfc/rfc4180.txt|RFC 4180] formatted comma-separated
values, and returns that content as if it were rows and columns of an SQL
table.
</p>

<p>
The CSV virtual table is useful to applications that need to bulk-load
large amounts of comma-separated value content.
The CSV virtual table is also useful as a template source file for
implementing other virtual tables.
</p>

<h2>Overview</h2>

<p>
The CVS virtual table is not built into the SQLite amalgamation.
It is available as a
[https://www.sqlite.org/src/artifact?ci=trunk&filename=ext/misc/csv.c|separate source file]
that can be compiled into a [loadable extension].
Typical usage of the CSV virtual table from the
[command-line shell] would be something like this:

<blockquote><pre>
.load ./csv
CREATE VIRTUAL TABLE temp.t1 USING csv(filename='thefile.csv');
SELECT * FROM t1;
</pre></blockquote>

<p>
The first line of the script above causes the [command-line shell] to
read and activate the run-time loadable extension for CSV.  For an
application, the equivalent C-language API is
[sqlite3_load_extension()].
Observe that the filename extension (ex: ".dll" or ".so" or ".dylib") is
|

>
|
|















<









|



|







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
<title>The CSV Virtual Table</title>
<tcl>hd_keywords csv {CSV virtual table}</tcl>
<fancy_format>

<h1>Overview</h1>

<p>
The CSV virtual table reads
[https://www.ietf.org/rfc/rfc4180.txt|RFC 4180] formatted comma-separated
values, and returns that content as if it were rows and columns of an SQL
table.
</p>

<p>
The CSV virtual table is useful to applications that need to bulk-load
large amounts of comma-separated value content.
The CSV virtual table is also useful as a template source file for
implementing other virtual tables.
</p>



<p>
The CVS virtual table is not built into the SQLite amalgamation.
It is available as a
[https://www.sqlite.org/src/artifact?ci=trunk&filename=ext/misc/csv.c|separate source file]
that can be compiled into a [loadable extension].
Typical usage of the CSV virtual table from the
[command-line shell] would be something like this:

<codeblock>
.load ./csv
CREATE VIRTUAL TABLE temp.t1 USING csv(filename='thefile.csv');
SELECT * FROM t1;
</codeblock>

<p>
The first line of the script above causes the [command-line shell] to
read and activate the run-time loadable extension for CSV.  For an
application, the equivalent C-language API is
[sqlite3_load_extension()].
Observe that the filename extension (ex: ".dll" or ".so" or ".dylib") is
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
The third line of the example shows the virtual table being used, to read
all content of the CSV file.  This is perhaps the simplest possible use
of the virtual table.  The CSV virtual table can be used anywhere an ordinary
virtual table can be used.  One can use the CSV virtual table inside subqueries,
or [common table expressions] or add WHERE, GROUP BY, HAVING, ORDER BY,
and LIMIT clauses as required.

<h2>Recognized Arguments</h2>

<p>
The example above showed a single <b>filename='th3file.csv'</b> argument
for the CSV virtual table.  But other arguments are also possible.

<ul>
<li><p><b>filename=</b><i>FILENAME</i>







|







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
The third line of the example shows the virtual table being used, to read
all content of the CSV file.  This is perhaps the simplest possible use
of the virtual table.  The CSV virtual table can be used anywhere an ordinary
virtual table can be used.  One can use the CSV virtual table inside subqueries,
or [common table expressions] or add WHERE, GROUP BY, HAVING, ORDER BY,
and LIMIT clauses as required.

<h1>Recognized Arguments</h1>

<p>
The example above showed a single <b>filename='th3file.csv'</b> argument
for the CSV virtual table.  But other arguments are also possible.

<ul>
<li><p><b>filename=</b><i>FILENAME</i>