qdbc [-a scope] [-B]
[-d database] [-f format]
[-q] [-S] [-t timeout] [-V] [-v[v...]] [sql]
- -a scope
- Set the scope of operation for the -B, -S and -V options. This can be one of:
- default — act on attached databases as specified in the configuration file (honoring the value of the Vacuum Attached, Backup Attached, and Size Attached parameters). This gives backwards-compatible behavior.
- all — always act on any attached databases, regardless of configuration file settings.
- none — act only on the connected database itself, and never on any attached databases.
- -B
- Perform a backup (the equivalent of calling qdb_backup()). The scope of this operation is determined by the configuration file for the database specified by -d or QDBC_DBNAME, or by the -a option, if specified.
- -d database
- The database you want to execute the SQL statement or other operation on. If this isn't specified, the value of the QDBC_DBNAME environment variable is used.
- -f format
- Format for the output. If this option isn't specified, the simple format is used by default. Can be one of:
- simple — plain text, including column names, with field data separated by a pipe character (|) (default)
- html — HTML-encoded text
- sgml — SGML-encoded text
- data — plain text, without column names, with field data separated by a tab character
- -q
- Reset verbosity to quiet mode.
- -S
- Print the database size information (the equivalent to calling qdb_getdbsize()) for the database specified by -d or QDBC_DBNAME. The scope of this operation is determined by the database configuration file, or the -a option, if specified.
- -t timeout
- Set the database connection timeout, in ms.
- -V
- Perform a vacuum operation (the equivalent to calling qdb_vacuum()). The scope of this operation is determined by the configuration file for the database specified by -d or QDBC_DBNAME, or by the -a option, if specified.
- -v[v...]
- Increase verbosity.
- sql
- An SQL statement you want to run on the specified database. This statement should be quoted, and end in a semicolon. If no SQL statement is specified, qdbc enters interactive mode and takes input from the command-line, giving you an SQL prompt. When you are finished entering SQL statements, press Ctrl-C to exit.
The QDB Client utility allows you to execute SQL statements on a qdb database without having to write code. It also allows you to perform backup, vacuum, and size query operations. This can be useful when developing QDB applications.
The -B, -S, -V and sql options are mutually exclusive; you cannot specify more than one.
The result of each SQL statement is displayed on the standard output by qdbc, if the -q option isn't set. You can also redirect a file containing SQL statements to QDB, for example: qdbc < sql.txt. If you enter SQL from a command-line in a terminal, qdbc enters interactive mode. In this mode, you can enter as many consecutive SQL statements as you want. Statements entered in interactive mode don't need to be enclosed in quotation marks, but should end in a semicolon.