Commandline Switches
Commandline switches are arguments that begin with a minus/hyphen (‘-
’) character.The following is an example of what happens when you attempt to start isql
with the help (“-?
”) switch — it displays the list of valid switches with a brief explanation of each.If an invalid switch is specified, isql
will also display the usage help.
$ isql -? usage: isql [options] [<database>] -a(ll) extract metadata incl. legacy non-SQL tables -b(ail) bail on errors (set bail on) -c(ache) <num> number of cache buffers -ch(arset) <charset> connection charset (set names) -d(atabase) <database> database name to put in script creation -e(cho) echo commands (set echo on) -ex(tract) extract metadata -f(etch_password) fetch password from file -i(nput) <file> input file (set input) -m(erge) merge standard error -m2 merge diagnostic -n(oautocommit) no autocommit DDL (set autoddl off) -nod(btriggers) do not run database triggers -now(arnings) do not show warnings -o(utput) <file> output file (set output) -pag(elength) <size> page length -p(assword) <password> connection password -q(uiet) do not show the message "Use CONNECT..." -r(ole) <role> role name -r2 <role> role (uses quoted identifier) -s(qldialect) <dialect> SQL dialect (set sql dialect) -t(erminator) <term> command terminator (set term) -tr(usted) use trusted authentication -u(ser) <user> user name -x extract metadata -z show program and server version
Not all of these switches appear in every release of Firebird.Some will be seen in more recent releases.Many of the switches have an equivalent set command, and these will be discussed below.
- Using
-b(ail)
-
The commandline switch
-b(ail)
instructs theisql
utility to bail on error, but only when used in a non-interactive mode.This switch prevents
isql
from continuing execution after an error has been detected.No further statements will be executed andisql
will return an error code to the operating system.Users will need to use the
-e(cho)
switch to echo commands to an output file, to isolate the exact statement that caused the error.When the server provides line and column information, users can see the exact line of the DML in the script that caused the problem.When the server only indicates failure, users can view the first line of the statement that caused the failure, in relation to the entire script.
This feature is also supported in nested scripts.For example, script A includes script B and script B causes a failure, the line number is related to script B.When script B is read completely,
isql
continues counting the lines related to script A, since each file gets a separate line counter.Script A includes script B when script A uses the INPUT command to load script B.Lines are counted according to what the underlying IO layer considers separate lines.For ports using EDITLINE, a line is what readline() provides in a single call.The line length limit of 32767 bytes remains uncharged.
- Using
-ex(tract)
-
The commandline switch
-ex(tract)
can be used to extract metadata from the database.In conjunction with the-o(utput)
switch, it extracts the information to a specified output file.The resultant information is the DDL to create the current structure of the database.
- Using
-m2
and-m(erge)
-
The commandline switch
-m2
— introduced in Firebird 2.0 — can be used to send the statistics and plans to the same output file that receives the input from the-o(utput)
switch.Before Firebird 2.0, when a user specified that the output should be sent to a file, two options existed: the commandline switch
-o(utput)
with a file name to store the output, or the commandOUTput
with a file name to store the output.Both these options could be employed either in a batch session or in the interactiveisql
shell.In both cases, simply passing the commandOUTput
would return the output to the console.While the console displayed error messages, these were not sent to the output file.The
-m(erge)
commandline switch, can be used to incorporate the error messages into the output files.The
-m2
commandline switch ensures that the stats and plan information derived from theSET STATS
, SET PER_TABLE_STATS`,SET PLAN
andSET PLANONLY
commands are also sent to the output file and not just returned to the console.NoteNeither
-m(erge)
nor-m2
has an interactive counterpart through aSET
command.They are for use only as commandlineisql
options. - _Using
-r2
and-r(ole)
-
These switches can be used to specify role name.The default switch for this is
-r(ole)
, and are uppercased (i.e. as unquoted identifiers, case-insensitive).With-r2
they are passed to the engine exactly as typed in the commandline, that is case-sensitive (as if they are quoted identifiers). Using `-o(utput)
-
The
OUTPUT
switch allows users to store records of commands to a script file.TheTMP
setting on a client can be used to control where these script files will be stored, if an absolute file path is not specified.