Documentation Source Text

Check-in [a2762f0319]
Login

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

Overview
Comment:Fix the CLI documentation to always use ".headers" instead of sometimes using the abbreviated ".header".
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a2762f031964e774a1cef9b90f82de8018da8b8346ff2f50709d93882d1caf73
User & Date: drh 2019-11-23 16:36:41
Context
2019-12-06
02:35
Enhance the rtree auxiliary column documentation to point out that constraints such as NOT NULL on auxiliary columns are silently ignored. SQLite ticket https://www.sqlite.org/src/info/8bf76328ac940d52 (check-in: c3ab325994 user: drh tags: trunk)
2019-11-23
16:36
Fix the CLI documentation to always use ".headers" instead of sometimes using the abbreviated ".header". (check-in: a2762f0319 user: drh tags: trunk)
00:22
Documentation updates for new features. (check-in: 604ac8689d user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to pages/cli.in.

346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
first row of data.  This makes the column width self-adjusting.
The default width setting for every column is this 
auto-adjusting 0 value.</p>

<p>Use a negative column width for right-justified columns.</p>

<p>The column labels that appear on the first two lines of output
can be turned on and off using the ".header" dot command.  In the
examples above, the column labels are on.  To turn them off you
could do this:</p>

<tclscript>DisplayCode {
sqlite> (((.header off)))
sqlite> (((select * from tbl1;)))
hello         10    
goodbye       20    
sqlite>
}</tclscript>

<p>Another useful output mode is "insert".  In insert mode, the output







|




|







346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
first row of data.  This makes the column width self-adjusting.
The default width setting for every column is this 
auto-adjusting 0 value.</p>

<p>Use a negative column width for right-justified columns.</p>

<p>The column labels that appear on the first two lines of output
can be turned on and off using the ".headers" dot command.  In the
examples above, the column labels are on.  To turn them off you
could do this:</p>

<tclscript>DisplayCode {
sqlite> (((.headers off)))
sqlite> (((select * from tbl1;)))
hello         10    
goodbye       20    
sqlite>
}</tclscript>

<p>Another useful output mode is "insert".  In insert mode, the output
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
<h1>CSV Export</h1>

<p>To export an SQLite table (or part of a table) as CSV, simply set
the "mode" to "csv" and then run a query to extract the desired rows
of the table.

<tclscript>DisplayCode {
sqlite> (((.header on)))
sqlite> (((.mode csv)))
sqlite> (((.once c:/work/dataout.csv)))
sqlite> (((SELECT * FROM tab1;)))
sqlite> (((.system c:/work/dataout.csv)))
}</tclscript>

<p>In the example above, the ".header on" line causes column labels to
be printed as the first row of output.  This means that the first row of
the resulting CSV file will contain column labels.  If column labels are
not desired, set ".header off" instead. (The ".header off" setting is
the default and can be omitted if the headers have not been previously
turned on.)

<p>The line ".once <i>FILENAME</i>" causes all query output to go into
the named file instead of being printed on the console.  In the example
above, that line causes the CSV content to be written into a file named
"C:/work/dataout.csv".







|






|


|







656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
<h1>CSV Export</h1>

<p>To export an SQLite table (or part of a table) as CSV, simply set
the "mode" to "csv" and then run a query to extract the desired rows
of the table.

<tclscript>DisplayCode {
sqlite> (((.headers on)))
sqlite> (((.mode csv)))
sqlite> (((.once c:/work/dataout.csv)))
sqlite> (((SELECT * FROM tab1;)))
sqlite> (((.system c:/work/dataout.csv)))
}</tclscript>

<p>In the example above, the ".headers on" line causes column labels to
be printed as the first row of output.  This means that the first row of
the resulting CSV file will contain column labels.  If column labels are
not desired, set ".headers off" instead. (The ".headers off" setting is
the default and can be omitted if the headers have not been previously
turned on.)

<p>The line ".once <i>FILENAME</i>" causes all query output to go into
the named file instead of being printed on the console.  In the example
above, that line causes the CSV content to be written into a file named
"C:/work/dataout.csv".