dbsql
Prev | Appendix A. Berkeley DB Command Line Utilities | Next

## dbsql

    dbsql [OPTIONS] FILENAME SQL

dbsql is a command line tool that provides access to the Berkeley DB SQL interface. To build this tool, run the configure script with the `--enable-sql` option when you are building the Berkeley DB SQL interface. For more information on building this tool, see "Building for UNIX/POSIX".

FILENAME is the name of a Berkeley DB database file created with the SQL interface. A new database is created if the file does not exist. The options are as follows:

- -init filename

  Reads/processes named file.

- -echo

  Prints commands before execution.

- -[no]header

  Turns headers on or off.

- -bail

  Stops after hitting an error.

- -interactive

  Forces interactive I/O.

- -batch

  Forces batch I/O.

- -column

  Sets output mode to column.

- -csv

  Sets output mode to csv.

- -html

  Sets output mode to HTML.

- -line

  Sets output mode to line.

- -list

  Sets output mode to list.

- -separator 'x'

  Sets output field separator (|).

- -nullvalue 'text'

  Sets text string for NULL values.

- -version

  Shows SQLite version.

The dbsql executable provides the same interface as the sqlite3 executable that is part of SQLite. For more information on how to use dbsql see the SQLite Documentation page.

### Command Line Features Unique to dbsql

This section describes pre-defined query statements that can be executed from the dbsql command line.

.stat ?ITEM? Prints statistics If ITEM is :env:, then this command prints statistics for the Berkeley DB environment using the DB_ENV->stat_print().
    dbsql> .stat :env:
If ITEM is the name of a table or index, then this command prints statistics for the table or index using the DB->stat_print().
    dbsql> .stat example
If ITEM is not specified, then this command prints statistics for the Berkeley DB environment followed by statistics for all tables and indexes within the database.
    dbsql> .stat

Prev | Up | Next
db_sql_codegen | Home | db_stat