This appendix lists the commands that can be used within the sqlite
monitor program.
The dot commands for sqlite
can be used to change the output format, fetch information about the database, and modify some settings. In this appendix, each dot command is shown first followed by an explanation.
The default output mode. Displays one line per record, with each column separated by a specific character or string. The default separator is the pipe character (|).
Changes the separator for list mode output to string
.
Causes sqlite
to output each column in the result of a query to be displayed on a line by itself, with the value prefixed by the name of the column. Subsequent records are separated by a blank line.
Displays one line per record with data aligned in fixed-width columns.
Specifies the width in characters for each column in turn, where width1
is the leftmost column returned by the query.
A width setting of 0
(the default) will automatically size the column to whichever is largest of: the length of the column heading, the length of the value in the first row of data, or 10 characters.
Determines whether column headings are displayed in column output mode.
Causes a list of full INSERT
statements to be generated for the records returned by the query. The table-name
argument determines the name of the table for the INSERT
statements.
The output is generated as an XHTML table with one set of <TR>
tags and each column as a <TD>
element. If .headers on
has been specified, <TH>
tags are used for the column headings.
Specifies a value to display wherever a NULL
value appears in the result of the query.
When echo is set to on
, the SQL command being executed is included as the first line of the output.
Specifies a fixed-width column output mode suitable for the result of the EXPLAIN
SQL command. Using .explain off
reverts the output settings to their former values.
Displays the current settings for echo
, explain
, headers
, mode
, nullvalue
, output
, separator
, and width
.
Executes one or more SQL commands from filename
in turn. A syntax error in the file will cause an error to be displayed but will not prevent execution of the remaining commands.
Specifies that the output from queries should be sent to filename
. If filename
already exists, it is overwritten with the new output.
.output stdout
Specifies that output should be sent to standard output—usually the screen, but sqlite
may also be used in a shell script with output redirection.
Lists the names of currently attached databases and the paths to the database files.
Lists all tables in the primary attached database that contain pattern
. If no pattern
is given, all tables in the database are listed. Note that tables in databases attached with the ATTACH DATABASE
command are not listed.
Shows the CREATE TABLE
statement that was used to create table-name
. If no table-name
is given, the entire database schema is displayed.
Generates a list of SQL commands that contain the CREATE TABLE
and INSERT
statements required to re-create the table specified. If no table-name
is given, the entire database is dumped.
Lists the names of each index in turn on the given table. The table-name
argument is required.
Allows you to customize the prompts displayed when using sqlite
. The two arguments replace the main prompt (usually sqlite>
) and the continuation prompt (usually ...>
) respectively. If only one argument is given, it is assumed to be the main prompt.
3.128.197.164