$ basex -h
BaseX [Standalone]
Usage: basex [-bcdiLosuvVwxzbcdiLoqrRsuvVwxXz] [input]
[input] Execute input file or expression
-b<pars> Bind external query variables
-o<output> Write output to file
-q<expr> Execute XQuery expression
-r<num> Set number of query executions
-R Turn query execution on/off
-s<pars> Set serialization parameter(s)
-u Write updates back to original files
-w Preserve whitespaces from input files
-x Show query execution plan
-X Show query plan before/after compilation
-z Skip output of results
</pre>
! width="40%" | Description
! Option
! Default
! Examples
|- valign="top"
* The input string may point to an existing file. If the file suffix is {{Code|.bxs}}, the file content will be evaluated as [[Commands#Basics|Command Script]]; otherwise, it will be evaluated as XQuery expression.
* Otherwise, the input string itself is evaluated as XQuery expression.
|
|
|• {{Code|"doc('X')//head"}}<br/>• {{Code|query.xq}}<br/>• {{Code|commands.bxs}}<br/>
| Binds external variables to XQuery expressions. This flag may be specified multiple times. Variables names and their values are delimited by equality signs (<code>=</code>). The names may be optionally prefixed with dollar signs. If a variable uses a namespace different to the default namespace, it can be specified with the [http://www.jclark.com/xml/xmlns.htm Clark Notation].
| <code>[[Options#BINDINGS|BINDINGS]]</code>
|
|• <code>-b$v=example "$v"</code><br/>• <code>-b{URL}ln=value<br/>"declare namespace ns='URL'; $ns:ln"</code>
|- valign="top"
* Several commands in the input can be separated by semicolons ({{Code|;}}).
* If the specified input is a valid file reference or URL, its content will be executed instead. Empty lines and lines starting with the number sign {{Code|#}} will be ignored.
|
|
|• {{Code|-c"list;info"}}<br/>• {{Code|-ccommands.txt}}<br/>• {{Code|-c"<info/>"}}
| Toggles the debugging mode. Debugging information is output to ''standard error''.
| <code>[[Options#DEBUG|DEBUG]]</code>
| <code>false</code>
|
|- valign="top"
| {{Code|-i<input>}}
| Opens a database or XML document specified by the argument. The opened input may be further processed by an XQuery expression.
|
|
|
| {{Code|-iitems.xml "//item"}}
| Separates returned query items by newlines (instead of spaces) and appends a newline to the end of a result.
|
| <code>false</code>
|
|- valign="top"
| {{Code|-o<file>}}
| All command and query output is written to the specified file.
|
|
| {{Code|-o output.txt}}
| {{Code|-q<expr>}}
| Executes the specified string as XQuery expression.
|
|
| {{Code|-q"doc('input')//head"}}
|- valign="top"
| {{Code|-r<num>}}
| Specifies how often a specified query will be evaluated.
| <code>[[Options#RUNS|RUNS]]</code>
| <code>1</code>
| {{Code|-V -r10 "1"}}
|- valign="top"
| {{Code|-R}}
| Specifies if a query will be executed or parsed only.
| <code>[[Options#RUNQUERY|RUNQUERY]]</code>
| <code>true</code>
| {{Code|-V -R "1"}}
|- valign="top"
| {{Code|-s<pars>}}
| Specifies parameters for serializing XQuery results; see [[Serialization]] for more details. This flag may be specified multiple times. Key and values are separated by the equality sign (<code>=</code>).
| <code>[[Options#SERIALIZER|SERIALIZER]]</code>
|
| <code>-smethod=text</code>
|- valign="top"
| Propagates updates on input files back to disk.
| <code>[[Options#WRITEBACK|WRITEBACK]]</code>
| <code>false</code>
|
|- valign="top"
| Prints process and timing information to the ''standard output''.
|
| <code>false</code>
|
|- valign="top"
| Prints detailed query information to the ''standard output'', including details on the compilation and profiling steps.
| <code>[[Options#QUERYINFO|QUERYINFO]]</code>
| <code>false</code>
|
|- valign="top"
| {{Code|-w}}
| By default, Specifies if whitespaces around in XML text nodes are should be chopped when a database (which is created. This flag can be specified to preserve whitespacesthe default) or preserved.
| <code>[[Options#CHOP|CHOP]]</code>
| <code>true</code>
|
|- valign="top"
| This flags turn on the output of the query execution plan, formatted in [[Options#XMLPLAN|XML]].
| <code>[[Options#XMLPLAN|XMLPLAN]]</code>
| <code>false</code>
|
|- valign="top"
| {{Code|-X}}
| Creates the query plan before or after query compilation.
| <code>[[Options#COMPPLAN|COMPPLAN]]</code>
| <code>true</code>
|
|- valign="top"
| {{Code|-z}}
| Skips Turns the serialization of XQuery resultson/off. This flag is useful if the query is profiled or analyzed.
| <code>[[Options#SERIALIZE|SERIALIZE]]</code>
| <code>true</code>
|
|}
$ basexclient -h
BaseX [Client]
Usage: basexclient [-bcdiLnopPsUvVwxzbcdiLnopPqrRsUvVwxXz] [input]
[input] Execute input file or expression
-b<pars> Bind external query variables
-P<pass> Specify user password
-q<expr> Execute XQuery expression
-r<num> Set number of query executions
-R Turn query execution on/off
-s<pars> Set serialization parameter(s)
-U<name> Specify user name
-w Preserve whitespaces from input files
-x Show query execution plan
-X Show query plan before/after compilation
-z Skip output of results
</pre>
The flags have the following meaning (equivalent database options are shown in the table as well).
For the examples to work escaping some characters might be necessary, depending on your Operating System.
{| class="wikitable"
| This flags turn on the output of the query execution plan, formatted in [[Options#XMLPLAN|XML]].
| <code>[[Options#XMLPLAN|XMLPLAN]]</code>
|
|
|- valign="top"
| {{Code|-X}}
| Creates the query plan before or after query compilation.
| <code>[[Options#COMPPLAN|COMPPLAN]]</code>
|
|