Difference between revisions of "Command-Line Options"

From BaseX Documentation
Jump to navigation Jump to search
Line 160: Line 160:
 
==BaseX Standalone==
 
==BaseX Standalone==
  
;Console command
+
;Launch the interactive mode:
 
:<code>
 
:<code>
 
> basex
 
> basex
 
</code>
 
</code>
  
All available command-line flags can be listed by adding <code>-h</code> to the call:
+
Available command-line options can be listed with the <code>-h</code> flag:
 
:<code>
 
:<code>
 
> basex -h
 
> basex -h
Line 174: Line 174:
 
   -c<cmd>    Execute database command(s)
 
   -c<cmd>    Execute database command(s)
 
   -d        Activate debugging mode
 
   -d        Activate debugging mode
   -i<file>   Open initial file or database
+
   -i<input> Open initial file or database
 
   -o<file>  Write output to file
 
   -o<file>  Write output to file
 
   -q<expr>  Execute XQuery expression
 
   -q<expr>  Execute XQuery expression
Line 180: Line 180:
 
   -u        Modifiy original files after updates
 
   -u        Modifiy original files after updates
 
   -v/V      Show (all) process info
 
   -v/V      Show (all) process info
   -w        wrap query result to xml
+
   -w        Retain whitespaces from source files
 
   -z        Skip output of results
 
   -z        Skip output of results
 
</pre>
 
</pre>
 +
 +
The command-line flags have the following meaning:
 +
 +
{| class="wikitable"
 +
|- valign="top"
 +
! width='70' | Flag
 +
! Description
 +
! width='165' | Examples
 +
|- valign="top"
 +
| <code>[file]</code>
 +
| Execute the specified XQuery file.
 +
|
 +
|- valign="top"
 +
| <code>-c&lt;cmd&gt;</code>
 +
| Launch database commands and skip interactive mode. The flag should be placed last, as all remaining characters are interpreted as commands. Several commands can be separated by semicolons.
 +
| <code>-c"list;info"</code>
 +
|- valign="top"
 +
| <code>-d</code>
 +
| Turn on debugging. Debugging information is output to ''standard error''.
 +
|
 +
|- valign="top"
 +
| <code>-i&lt;input&gt;</code>
 +
| Open a database or XML document specified by the argument. The opened input may be further processed by an XQuery expression.
 +
| <code>-iitems.xml -q"//item"</code>
 +
|- valign="top"
 +
| <code>-o&lt;file&gt;</code>
 +
| Command and query output is written to the specified file.
 +
| <code>-p9999</code>
 +
|- valign="top"
 +
| <code>-q&lt;expr&gt;</code>
 +
| Execute the specified string as XQuery expression. The flag should be placed last, as all remaining characters are interpreted as XQuery.
 +
| <code>-q"doc('input')//head"</code>
 +
|- valign="top"
 +
| <code>-s&lt;pars&gt;</code>
 +
| Specify parameters for serializing XQuery results, as specified in the [http://www.w3.org/TR/xslt-xquery-serialization/ W3C XQuery Serialization] document. Key/value pairs are separated by equality signs (<code>=</code>).
 +
| <code>-smethod=text</code>
 +
|- valign="top"
 +
| <code>-v</code>
 +
| Process information is written to ''standard output''.
 +
|
 +
|- valign="top"
 +
| <code>-V</code>
 +
| Detailed query information is written to ''standard output'', including compilation and profiling steps.
 +
|
 +
|- valign="top"
 +
| <code>-w</code>
 +
| By default, whitespaces around text nodes are chopped when a database is created. This flag can be specified to suppress chopping.
 +
|
 +
|- valign="top"
 +
| <code>-z</code>
 +
| Skip the serialization of XQuery results. This flag may be useful for analyzing query plans.
 +
|
 +
|}
  
 
[[Category:Beginner]]
 
[[Category:Beginner]]

Revision as of 22:13, 23 January 2011

This page gives an overview on all command-line options of the BaseX Startup scripts:

BaseX Server

Console command

> basexserver

If the server has been succesfully started, this is coming up:

BaseX [Server]
Server was started.

Additional command-line flags can be listed by adding -h to the call:

> basexserver -h

Usage: BaseXServer [-dpsz] [-c] [stop]
  stop     Stop existing server
  -c<cmd>  Execute initial database command(s)
  -d       Activate debugging mode
  -i       Enter interactive mode
  -p<num>  Set server port
  -s       Start as service
  -z       Suppress logging

The command-line flags have the following meaning:

Flag Description Examples
stop Stop an existing server instance; remaining input is ignored.
-c<cmd> Launch database commands before the server itself is started; all remaining text is interpreted as command input. Several commands can be separated by semicolons. -c"open database;info"
-d Turn on debugging. Debugging information is output to standard error (STDERR).
-i Interactively enter commands on the console, similar to standalone and client mode.
-p<num> Specify the port on which the server can be addressed. -p9999
-s Start the server as service (i.e., in background).
-z Do not generate log files.

BaseX Client

Launch interactive mode

> basexclient

The user name and password is requested. The default user/password combination is admin/admin:

Username: admin
Password:
> _

Available command-line flags can be listed by adding -h to the call:

> basexclient -h

Usage: BaseXClient [-npPU] [-dovVwz] [-cq] [file]
  [file]     Execute XQuery file
  -c<cmd>    Execute database command(s)
  -d         Activate debugging mode
  -n<name>   Set server (host) name
  -o<file>   Write output to file
  -p<num>    Set server port
  -P<pass>   Specify user password
  -q<expr>   Execute XQuery expression
  -U<name>   Specify user name
  -v/V       Show (all) process info
  -w         Retain whitespaces from source files
  -z         Skip XQuery serialization

The command-line flags have the following meaning:

Flag Description Examples
[file] Execute the specified XQuery file.
-c<cmd> Launch database commands and skip interactive mode. The flag should be placed last, all remaining characters are interpreted as commands. Several commands can be separated by semicolons. -c"list;info"
-d Turn on debugging. Debugging information is output to standard error (STDERR).
-n<name> Specify the server name on which the server is running. -nserver.basex.org
-o<file> Command and query output is written to the specified file. -p9999
-p<num> Specify the port on which the server is running. -p9999
-P<pass> Specify the user password. Warning: when the password is specified on command-line, it may be visible to others. -Uadmin -Padmin
-q<expr> Execute the specified string as XQuery expression. The flag should be placed last, as all remaining characters are interpreted as XQuery. -q"doc('input')//head"
-U<name> Specify the user name. -Uadmin
-v Process information is written to standard output (STDOUT).
-V Detailed query information is written to standard output (STDOUT), including compilation and profiling steps.
-w By default, whitespaces around text nodes are chopped when a database is created. This flag can be specified to suppress chopping.
-z Skip the serialization of XQuery results. This flag may be useful for analyzing query plans.

BaseX Standalone

Launch the interactive mode

> basex

Available command-line options can be listed with the -h flag:

> basex -h

Usage: BaseX [-diosuvVwz] [-cq] [file]
  [file]     Execute XQuery file
  -c<cmd>    Execute database command(s)
  -d         Activate debugging mode
  -i<input>  Open initial file or database
  -o<file>   Write output to file
  -q<expr>   Execute XQuery expression
  -s<pars>   Set serialization parameter(s)
  -u         Modifiy original files after updates
  -v/V       Show (all) process info
  -w         Retain whitespaces from source files
  -z         Skip output of results

The command-line flags have the following meaning:

Flag Description Examples
[file] Execute the specified XQuery file.
-c<cmd> Launch database commands and skip interactive mode. The flag should be placed last, as all remaining characters are interpreted as commands. Several commands can be separated by semicolons. -c"list;info"
-d Turn on debugging. Debugging information is output to standard error.
-i<input> Open a database or XML document specified by the argument. The opened input may be further processed by an XQuery expression. -iitems.xml -q"//item"
-o<file> Command and query output is written to the specified file. -p9999
-q<expr> Execute the specified string as XQuery expression. The flag should be placed last, as all remaining characters are interpreted as XQuery. -q"doc('input')//head"
-s<pars> Specify parameters for serializing XQuery results, as specified in the W3C XQuery Serialization document. Key/value pairs are separated by equality signs (=). -smethod=text
-v Process information is written to standard output.
-V Detailed query information is written to standard output, including compilation and profiling steps.
-w By default, whitespaces around text nodes are chopped when a database is created. This flag can be specified to suppress chopping.
-z Skip the serialization of XQuery results. This flag may be useful for analyzing query plans.