Difference between revisions of "Commands"
Line 10: | Line 10: | ||
A shortcut exists for some of the command keywords. For example, you may replace | A shortcut exists for some of the command keywords. For example, you may replace | ||
the <code>DATABASE</code> keyword with <code>DB</code>. | the <code>DATABASE</code> keyword with <code>DB</code>. | ||
+ | |||
+ | =Glob Syntax= | ||
+ | |||
+ | For some commands, the glob syntax can be used to address more than one database or user. Question marks and asterisks can be used to match one or more characters, and commas can be used to separate multiple patterns. Some examples: | ||
+ | |||
+ | * <code>AB?</code> addresses all names with the characters <code>AB</code> and one more character. | ||
+ | * <code>*AB</code> addresses all names ending with the characters <code>AB</code>. | ||
+ | * <code>X*,Y*,Z*</code> addresses all names starting with the characters <code>X</code>, <code>Y</code>, or <code>Z</code>. | ||
+ | |||
+ | =Commands= | ||
==ADD== | ==ADD== | ||
Line 18: | Line 28: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''WRITE'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 40: | Line 50: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''CREATE'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 60: | Line 70: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''ADMIN'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 67: | Line 77: | ||
| valign='top' | '''Errors''' | | valign='top' | '''Errors''' | ||
|The command fails if the specified user does not exist, or if no password has been specified. | |The command fails if the specified user does not exist, or if no password has been specified. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
Line 96: | Line 86: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''CREATE'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 112: | Line 102: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''NONE'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 128: | Line 118: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''CREATE'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 136: | Line 126: | ||
|The command fails if the target database already exists, or if the source database does not exist. | |The command fails if the target database already exists, or if the source database does not exist. | ||
|} | |} | ||
+ | ==CREATE BACKUP== | ||
+ | {| | ||
+ | |- | ||
+ | | valign='top' width='90' | '''Signature''' | ||
+ | |<code>CREATE BACKUP [name]</code> | ||
+ | |- | ||
+ | | valign='top' | '''Permission''' | ||
+ | |''CREATE'' | ||
+ | |- | ||
+ | | valign='top' | '''Summary''' | ||
+ | |Creates a zipped backup of the specified database. The backup file will be suffixed with the current timestamp and stored in the database directory. The Glob syntax can be used to address more than one database. | ||
+ | |- | ||
+ | | valign='top' | '''Errors''' | ||
+ | |The command fails if the specified database does not exist, or if it could not be zipped for some other reason. | ||
+ | |- | ||
+ | | valign='top' | '''Examples''' | ||
+ | | | ||
+ | * <code>BACKUP db</code><br/>creates a zip archive of the database <code>db</code> (e.g. <code>db-2011-04-01-12-27-28.zip</code>) in your [[Configuration#Database_Directory|database directory]]. | ||
+ | |} | ||
+ | |||
==CREATE DATABASE== | ==CREATE DATABASE== | ||
{| | {| | ||
Line 143: | Line 153: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''CREATE'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 166: | Line 176: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''WRITE'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
− | |Creates the specified database index. | + | |Creates the specified database [[Indexes|index]]. |
|- | |- | ||
| valign='top' | '''Errors''' | | valign='top' | '''Errors''' | ||
|The command fails if no database is opened, if the specified index is unknown, or if indexing fails for some other reason. | |The command fails if no database is opened, if the specified index is unknown, or if indexing fails for some other reason. | ||
|} | |} | ||
+ | |||
+ | ==CREATE EVENT== | ||
+ | {| | ||
+ | |- | ||
+ | | valign='top' width='90' | '''Signature''' | ||
+ | |<code>CREATE EVENT [NAME]</code> | ||
+ | |- | ||
+ | | valign='top' | '''Permission''' | ||
+ | |''ADMIN'' | ||
+ | |- | ||
+ | | valign='top' | '''Summary''' | ||
+ | |Creates the specified [[Events|event]]. | ||
+ | |- | ||
+ | | valign='top' | '''Errors''' | ||
+ | |The command fails if event already exists. | ||
+ | |} | ||
+ | |||
==CREATE USER== | ==CREATE USER== | ||
{| | {| | ||
Line 181: | Line 208: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''ADMIN'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 211: | Line 238: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''WRITE'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 226: | Line 253: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''CREATE'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
− | |Drops all backups of the database with the specified <code>[name]</code>. | + | |Drops all backups of the database with the specified <code>[name]</code>. The Glob syntax can be used to address more than one database. |
+ | |- | ||
+ | | valign='top' | '''Examples''' | ||
+ | | | ||
+ | * <code>DROP BACKUP abc*</code><br/>deletes the backups of all databases starting with the characters <code>abc</code>. | ||
|} | |} | ||
+ | |||
==DROP DATABASE== | ==DROP DATABASE== | ||
{| | {| | ||
Line 238: | Line 270: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''CREATE'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
− | |Drops the database with the specified <code>[name]</code>. | + | |Drops the database with the specified <code>[name]</code>. The Glob syntax can be used to address more than one database. |
|- | |- | ||
| valign='top' | '''Errors''' | | valign='top' | '''Errors''' | ||
|The command fails if the specified database does not exist or is currently locked, or if the database could not be deleted for some other reason. | |The command fails if the specified database does not exist or is currently locked, or if the database could not be deleted for some other reason. | ||
|} | |} | ||
+ | |||
+ | ==DROP EVENT== | ||
+ | {| | ||
+ | |- | ||
+ | | valign='top' width='90' | '''Signature''' | ||
+ | |<code>DROP EVENT [NAME]</code> | ||
+ | |- | ||
+ | | valign='top' | '''Permission''' | ||
+ | |''ADMIN'' | ||
+ | |- | ||
+ | | valign='top' | '''Summary''' | ||
+ | |Drops the specified [[Events|event]]. | ||
+ | |- | ||
+ | | valign='top' | '''Errors''' | ||
+ | |The command fails if the event doesn't exist. | ||
+ | |} | ||
+ | |||
==DROP INDEX== | ==DROP INDEX== | ||
{| | {| | ||
Line 253: | Line 302: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''WRITE'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
− | |Drops the specified database index. | + | |Drops the specified database [[Indexes|index]]. |
|- | |- | ||
| valign='top' | '''Errors''' | | valign='top' | '''Errors''' | ||
|The command fails if no database is opened, if the specified index is unknown, or if it could not be deleted for some other reason. | |The command fails if no database is opened, if the specified index is unknown, or if it could not be deleted for some other reason. | ||
|} | |} | ||
+ | |||
==DROP USER== | ==DROP USER== | ||
{| | {| | ||
Line 268: | Line 318: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''ADMIN'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
− | |Drops the user with the specified <code>[name]</code>. If a <code>[database]</code> is specified, the user is only dropped locally. The | + | |Drops the user with the specified <code>[name]</code>. If a <code>[database]</code> is specified, the user is only dropped locally. The Glob syntax can be used to address more than one database or user. |
|- | |- | ||
| valign='top' | '''Errors''' | | valign='top' | '''Errors''' | ||
Line 283: | Line 333: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''NONE'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 295: | Line 345: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''CREATE'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 311: | Line 361: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''READ'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 327: | Line 377: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''READ'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 335: | Line 385: | ||
|The command fails if the specified option is unknown. | |The command fails if the specified option is unknown. | ||
|} | |} | ||
+ | |||
==GRANT== | ==GRANT== | ||
{| | {| | ||
Line 342: | Line 393: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''ADMIN'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
− | |Grants the specified [[User_Management|permission]] to the specified <code>[user]</code>. If a <code>[database]</code> is specified, the permissions are only granted locally. The | + | |Grants the specified [[User_Management|permission]] to the specified <code>[user]</code>. If a <code>[database]</code> is specified, the permissions are only granted locally. The Glob syntax can be used to address more than one database or user. |
|- | |- | ||
| valign='top' | '''Errors''' | | valign='top' | '''Errors''' | ||
− | |The command fails if <code>admin</code> is specified as user name | + | |The command fails if <code>admin</code> is specified as user name, if the specified user does not exist, or if the optional database could not be opened for modification. |
+ | |- | ||
+ | | valign='top' | '''Examples''' | ||
+ | | | ||
+ | * <code>GRANT READ TO JoeWinson</code><br/>grants <code>READ</code> permission to the user <code>JoeWinson</code>. | ||
+ | * <code>GRANT WRITE ON Wiki TO editor*</code><br/>grants <code>WRITE</code> permissions on the <code>Wiki</code> database to all users starting with the characters <code>editor*</code>. | ||
|} | |} | ||
Line 358: | Line 414: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''NONE'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 373: | Line 429: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''READ'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 385: | Line 441: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''READ'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 400: | Line 456: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''READ'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
− | |Shows information on the existing index structures. The output can be optionally limited to the specified index. | + | |Shows information on the existing [[Indexes|index]] structures. The output can be optionally limited to the specified index. |
|- | |- | ||
| valign='top' | '''Errors''' | | valign='top' | '''Errors''' | ||
Line 416: | Line 472: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''READ'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 431: | Line 487: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''ADMIN'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
− | |Kills all sessions of the user specified by <code>[name]</code>. | + | |Kills all sessions of the user specified by <code>[name]</code>. The Glob syntax can be used to address more than one user. |
|- | |- | ||
| valign='top' | '''Errors''' | | valign='top' | '''Errors''' | ||
Line 446: | Line 502: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''NONE'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 461: | Line 517: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''READ'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 476: | Line 532: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''WRITE'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 491: | Line 547: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''NONE'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 499: | Line 555: | ||
|The command fails if no password has been specified. | |The command fails if no password has been specified. | ||
|} | |} | ||
+ | ==RENAME== | ||
+ | {| | ||
+ | |- | ||
+ | | valign='top' width='90' | '''Signature''' | ||
+ | |<code>RENAME [path] [newpath]</code> | ||
+ | |- | ||
+ | | valign='top' | '''Permission''' | ||
+ | |Write | ||
+ | |- | ||
+ | | valign='top' | '''Summary''' | ||
+ | |Renames all document paths in the currently opened database that start with the specified <code>[path]</code>. The command may be used to either rename single documents or directories. | ||
+ | |- | ||
+ | | valign='top' | '''Errors''' | ||
+ | |The command fails if no database is opened, or if the target path is empty. | ||
+ | |- | ||
+ | | valign='top' | '''Examples''' | ||
+ | | | ||
+ | * <code>RENAME one.xml two.xml</code><br/>renames the document <code>one.xml</code> to <code>two.xml</code>. | ||
+ | * <code>RENAME / TOP</code><br/>moves all documents to a <code>TOP</code> root directory. | ||
+ | |} | ||
+ | |||
+ | ==REPLACE== | ||
+ | {| | ||
+ | |- | ||
+ | | valign='top' width='90' | '''Signature''' | ||
+ | |<code>REPLACE [path] [input]</code> | ||
+ | |- | ||
+ | | valign='top' | '''Permission''' | ||
+ | |Write | ||
+ | |- | ||
+ | | valign='top' | '''Summary''' | ||
+ | |Replaces the documents in the currently opened database, addressed by <code>[path]</code>, with the file or XML string specified by <code>[input]</code>. The original file name and path is preserved by the operation. | ||
+ | |- | ||
+ | | valign='top' | '''Errors''' | ||
+ | |The command fails if no database is opened, if the specified path points to a database directory, or if the input is not found. | ||
+ | |- | ||
+ | | valign='top' | '''Examples''' | ||
+ | | | ||
+ | * <code>REPLACE one.xml input.xml</code><br/>replaces the document <code>one.xml</code> with the contents of the file <code>input.xml</code>. | ||
+ | * <code>REPLACE top.xml <xml/></code><br/>replaces the document <code>top.xml</code> with the document <code><xml/></code>. | ||
+ | |} | ||
+ | |||
+ | ==REPO DELETE== | ||
+ | {| | ||
+ | |- | ||
+ | | valign='top' width='90' | '''Signature''' | ||
+ | |<code>REPO DELETE [name|dir]</code> | ||
+ | |- | ||
+ | | valign='top' | '''Permission''' | ||
+ | |''ADMIN'' | ||
+ | |- | ||
+ | | valign='top' | '''Summary''' | ||
+ | | Deletes the package with name <code>[name]</code> or with directory <code>[dir]</code>. | ||
+ | |- | ||
+ | | valign='top' | '''Errors''' | ||
+ | | The command fails if the package to be deleted participates in a dependency. | ||
+ | |} | ||
+ | |||
+ | ==REPO INSTALL== | ||
+ | {| | ||
+ | |- | ||
+ | | valign='top' width='90' | '''Signature''' | ||
+ | |<code>REPO INSTALL [path]</code> | ||
+ | |- | ||
+ | | valign='top' | '''Permission''' | ||
+ | |''ADMIN'' | ||
+ | |- | ||
+ | | valign='top' | '''Summary''' | ||
+ | | Installs the package with path <code>[path]</code>. | ||
+ | |- | ||
+ | | valign='top' | '''Errors''' | ||
+ | | The command fails in the following cases: | ||
+ | * The package to be installed is not a xar file. | ||
+ | * The package to be installed does not exist or is already installed. | ||
+ | * The package descriptor is with invalid syntax. | ||
+ | * The package to be installed depends on a package which is not installed. | ||
+ | * The package is not supported by the current version of BaseX. | ||
+ | * A component of the package is already installed as part of another package. | ||
+ | |} | ||
+ | |||
+ | ==REPO LIST== | ||
+ | {| | ||
+ | |- | ||
+ | | valign='top' width='90' | '''Signature''' | ||
+ | |<code>REPO LIST</code> | ||
+ | |- | ||
+ | | valign='top' | '''Permission''' | ||
+ | |''ADMIN'' | ||
+ | |- | ||
+ | | valign='top' | '''Summary''' | ||
+ | | Lists all installed packages. | ||
+ | |} | ||
+ | |||
==RESTORE== | ==RESTORE== | ||
{| | {| | ||
Line 506: | Line 655: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''CREATE'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 538: | Line 687: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''READ'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 546: | Line 695: | ||
|The command fails if the specified option is unknown or if the specified value is invalid. | |The command fails if the specified option is unknown or if the specified value is invalid. | ||
|} | |} | ||
+ | |||
==SHOW BACKUPS== | ==SHOW BACKUPS== | ||
{| | {| | ||
Line 553: | Line 703: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''CREATE'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 565: | Line 715: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''ADMIN'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
Line 577: | Line 727: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''ADMIN'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
|Shows all sessions that are connected to the current server instance. | |Shows all sessions that are connected to the current server instance. | ||
|} | |} | ||
+ | ==SHOW EVENTS== | ||
+ | {| | ||
+ | |- | ||
+ | | valign='top' width='90' | '''Signature''' | ||
+ | |<code>SHOW EVENTS</code> | ||
+ | |- | ||
+ | | valign='top' | '''Permission''' | ||
+ | |''ADMIN'' | ||
+ | |- | ||
+ | | valign='top' | '''Summary''' | ||
+ | |Shows all [[Events|events]] that have been registered in the database. | ||
+ | |} | ||
+ | |||
==SHOW USERS== | ==SHOW USERS== | ||
{| | {| | ||
Line 589: | Line 752: | ||
|- | |- | ||
| valign='top' | '''Permission''' | | valign='top' | '''Permission''' | ||
− | | | + | |''ADMIN'' |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' |
Revision as of 19:46, 30 June 2011
This page lists all database commands that are supported by BaseX (another page contains all commands offered by the current snapshot). Database commands can either be run from the Command Line, the Clients, JAX-RX, the input field in the GUI, or in many other ways. If the GUI is used, all commands that are triggered by the GUI itself will show up in the Info View.
The Permissions indicate which
rights are required by a user to perform a command in the client/server architecture.
A shortcut exists for some of the command keywords. For example, you may replace
the DATABASE
keyword with DB
.
Contents
- 1 Glob Syntax
- 2 Commands
- 2.1 ADD
- 2.2 ALTER DATABASE
- 2.3 ALTER USER
- 2.4 CHECK
- 2.5 CLOSE
- 2.6 COPY
- 2.7 CREATE BACKUP
- 2.8 CREATE DATABASE
- 2.9 CREATE INDEX
- 2.10 CREATE EVENT
- 2.11 CREATE USER
- 2.12 CS
- 2.13 DELETE
- 2.14 DROP BACKUP
- 2.15 DROP DATABASE
- 2.16 DROP EVENT
- 2.17 DROP INDEX
- 2.18 DROP USER
- 2.19 EXIT
- 2.20 EXPORT
- 2.21 FIND
- 2.22 GET
- 2.23 GRANT
- 2.24 HELP
- 2.25 INFO
- 2.26 INFO DATABASE
- 2.27 INFO INDEX
- 2.28 INFO STORAGE
- 2.29 KILL
- 2.30 LIST
- 2.31 OPEN
- 2.32 OPTIMIZE
- 2.33 PASSWORD
- 2.34 RENAME
- 2.35 REPLACE
- 2.36 REPO DELETE
- 2.37 REPO INSTALL
- 2.38 REPO LIST
- 2.39 RESTORE
- 2.40 RUN
- 2.41 SET
- 2.42 SHOW BACKUPS
- 2.43 SHOW DATABASES
- 2.44 SHOW SESSIONS
- 2.45 SHOW EVENTS
- 2.46 SHOW USERS
- 2.47 XQUERY
Glob Syntax
For some commands, the glob syntax can be used to address more than one database or user. Question marks and asterisks can be used to match one or more characters, and commas can be used to separate multiple patterns. Some examples:
AB?
addresses all names with the charactersAB
and one more character.*AB
addresses all names ending with the charactersAB
.X*,Y*,Z*
addresses all names starting with the charactersX
,Y
, orZ
.
Commands
ADD
Signature | ADD (AS [name]) (TO [target]) [input]
|
Permission | WRITE |
Summary | Adds the files, directory or XML string specified by [input] to the currently opened database, using an optional [target] path and an optional file [name] .The input may either be a single XML document, a directory, a remote URL or a plain XML string. The optional name is ignored if the input is a directory. |
Errors | The command fails if no database is opened, if one of the documents to be added is not well-formed, or if it could not be parsed for some other reason. |
Examples |
|
ALTER DATABASE
Signature | ALTER DATABASE [name] [newname]
|
Permission | CREATE |
Summary | Renames the database specified by [name] to [newname] .
|
Errors | The command fails if the target database already exists, if the source database does not exist or is currently locked, or if it could not be renamed for some other reason. |
Examples |
|
ALTER USER
Signature | ALTER USER [name] ([password])
|
Permission | ADMIN |
Summary | Alters the [password] of the user specified by [name] . If no password is specified in the console mode, it is requested via standard input.
|
Errors | The command fails if the specified user does not exist, or if no password has been specified. |
CHECK
Signature | CHECK [input]
|
Permission | CREATE |
Summary | Opens an existing database for the specified [input] or creates a new instance.
|
Errors | The command fails if the database could beither be opened nor created. |
CLOSE
Signature | CLOSE
|
Permission | NONE |
Summary | Closes the currently opened database. |
Errors | The command fails if the database files could not be closed for some unknown reason. |
COPY
Signature | COPY [name] [newname]
|
Permission | CREATE |
Summary | Creates a copy of the database specified by [name] .
|
Errors | The command fails if the target database already exists, or if the source database does not exist. |
CREATE BACKUP
Signature | CREATE BACKUP [name]
|
Permission | CREATE |
Summary | Creates a zipped backup of the specified database. The backup file will be suffixed with the current timestamp and stored in the database directory. The Glob syntax can be used to address more than one database. |
Errors | The command fails if the specified database does not exist, or if it could not be zipped for some other reason. |
Examples |
|
CREATE DATABASE
Signature | CREATE DATABASE [name] ([input])
|
Permission | CREATE |
Summary | Creates the database [name] with an optional [input] .The input may either be a single XML document, a directory, a remote URL or a plain XML string. |
Errors | The command fails if a database with the specified name is currently used by another process, or if one of the documents to be added is not well-formed or could not be parsed for some other reason. |
Examples |
|
CREATE INDEX
Signature | CREATE INDEX [TEXT|ATTRIBUTE|FULLTEXT|PATH]
|
Permission | WRITE |
Summary | Creates the specified database index. |
Errors | The command fails if no database is opened, if the specified index is unknown, or if indexing fails for some other reason. |
CREATE EVENT
Signature | CREATE EVENT [NAME]
|
Permission | ADMIN |
Summary | Creates the specified event. |
Errors | The command fails if event already exists. |
CREATE USER
Signature | CREATE USER [name] ([password]) :
|
Permission | ADMIN |
Summary | Creates a user with the specified [name] and [password] . If no password is specified in the console mode, it is requested via standard input.
|
Errors | The command fails if the specified user already exists, or if no password has been specified. |
CS
Signature | CS [query]
|
Permission | depends on query |
Summary | Evaluates the specified [query] and sets the result as new context set.
|
Errors | The command fails if no database is opened, if the specified query is invalid or if it does not return nodes of the currently opened database. |
DELETE
Signature | DELETE [path]
|
Permission | WRITE |
Summary | Deletes all documents from the currently opened database that start with the specified [path] .
|
Errors | The command fails if no database is opened. |
DROP BACKUP
Signature | DROP BACKUP [name]
|
Permission | CREATE |
Summary | Drops all backups of the database with the specified [name] . The Glob syntax can be used to address more than one database.
|
Examples |
|
DROP DATABASE
Signature | DROP DATABASE [name]
|
Permission | CREATE |
Summary | Drops the database with the specified [name] . The Glob syntax can be used to address more than one database.
|
Errors | The command fails if the specified database does not exist or is currently locked, or if the database could not be deleted for some other reason. |
DROP EVENT
Signature | DROP EVENT [NAME]
|
Permission | ADMIN |
Summary | Drops the specified event. |
Errors | The command fails if the event doesn't exist. |
DROP INDEX
Signature | DROP INDEX [PATH|TEXT|ATTRIBUTE|FULLTEXT]
|
Permission | WRITE |
Summary | Drops the specified database index. |
Errors | The command fails if no database is opened, if the specified index is unknown, or if it could not be deleted for some other reason. |
DROP USER
Signature | DROP USER [name] (ON [database]) :
|
Permission | ADMIN |
Summary | Drops the user with the specified [name] . If a [database] is specified, the user is only dropped locally. The Glob syntax can be used to address more than one database or user.
|
Errors | The command fails if admin is specified as user name, if the specified user does not exist or is logged in, or if the optional database could not be opened for modification.
|
EXIT
Signature | EXIT
|
Permission | NONE |
Summary | Exits the console mode. |
EXPORT
Signature | EXPORT [path]
|
Permission | CREATE |
Summary | Exports all documents in the database to the specified [path] , using the serializer options specified by the EXPORTER option.
|
Errors | The command fails if no database is opened, if the target path points to a file or is invalid, if the serialization parameters, or if the documents cannot be serialized for some other reason. |
FIND
Signature | FIND [keywords]
|
Permission | READ |
Summary | Builds and runs a query for the specified [keywords] . The following modifiers can be used to further limit search:
|
Errors | The command fails if no database is opened. |
GET
Signature | GET [option]
|
Permission | READ |
Summary | Returns the value of the specified [option] . A list of all options is available here.
|
Errors | The command fails if the specified option is unknown. |
GRANT
Signature | GRANT [NONE|READ|WRITE|CREATE|ADMIN] (ON [database]) TO [user]
|
Permission | ADMIN |
Summary | Grants the specified permission to the specified [user] . If a [database] is specified, the permissions are only granted locally. The Glob syntax can be used to address more than one database or user.
|
Errors | The command fails if admin is specified as user name, if the specified user does not exist, or if the optional database could not be opened for modification.
|
Examples |
|
HELP
Signature | HELP ([command])
|
Permission | NONE |
Summary | If [command] is specified, information on the specific command is printed; otherwise, all commands are listed.
|
Errors | The command fails if the specified command is unknown. |
INFO
Signature | INFO
|
Permission | READ |
Summary | Shows global information. |
INFO DATABASE
Signature | INFO DATABASE
|
Permission | READ |
Summary | Shows information on the currently opened database. |
Errors | The command fails if no database is opened. |
INFO INDEX
Signature | INFO INDEX ([TEXT|ATTRIBUTE|FULLTEXT|PATH])
|
Permission | READ |
Summary | Shows information on the existing index structures. The output can be optionally limited to the specified index. |
Errors | The command fails if no database is opened, or if the specified index is unknown. |
INFO STORAGE
Signature | INFO STORAGE [start end] | [query]
|
Permission | READ |
Summary | Shows the internal main table of the currently opened database. An integer range or a query may be specified as argument. |
Errors | The command fails if no database is opened, or if one of the specified arguments is invalid. |
KILL
Signature | KILL [name]
|
Permission | ADMIN |
Summary | Kills all sessions of the user specified by [name] . The Glob syntax can be used to address more than one user.
|
Errors | The command fails if admin is specified as user name, or if a user tries to kill his own sessions.
|
LIST
Signature | LIST ([path])
|
Permission | NONE |
Summary | Lists all available databases, or the documents in a database. [path] is the name of the database, optionally followed by a path to the requested documents.
|
Errors | The command fails if the optional database cannot be opened, or if the existing databases cannot be listed for some other reason. |
OPEN
Signature | OPEN [path]
|
Permission | READ |
Summary | Opens the documents in a database. [path] is the name of the database, optionally followed by a path to the requested documents.
|
Errors | The command fails if the specified database cannot be opened for some unknown reason. |
OPTIMIZE
Signature | OPTIMIZE (ALL)
|
Permission | WRITE |
Summary | Optimizes the current database structures. If the ALL flag is specified, the size of all database files is minimized.
|
Errors | The command fails if no database is opened, or if the currently opened database is a main-memory instance. |
PASSWORD
Signature | PASSWORD ([password])
|
Permission | NONE |
Summary | Changes the [password] of the current user. If no password is specified in the console mode, it is requested via standard input.
|
Errors | The command fails if no password has been specified. |
RENAME
Signature | RENAME [path] [newpath]
|
Permission | Write |
Summary | Renames all document paths in the currently opened database that start with the specified [path] . The command may be used to either rename single documents or directories.
|
Errors | The command fails if no database is opened, or if the target path is empty. |
Examples |
|
REPLACE
Signature | REPLACE [path] [input]
|
Permission | Write |
Summary | Replaces the documents in the currently opened database, addressed by [path] , with the file or XML string specified by [input] . The original file name and path is preserved by the operation.
|
Errors | The command fails if no database is opened, if the specified path points to a database directory, or if the input is not found. |
Examples |
|
REPO DELETE
Signature | REPO DELETE [name|dir]
|
Permission | ADMIN |
Summary | Deletes the package with name [name] or with directory [dir] .
|
Errors | The command fails if the package to be deleted participates in a dependency. |
REPO INSTALL
Signature | REPO INSTALL [path]
|
Permission | ADMIN |
Summary | Installs the package with path [path] .
|
Errors | The command fails in the following cases:
|
REPO LIST
Signature | REPO LIST
|
Permission | ADMIN |
Summary | Lists all installed packages. |
RESTORE
Signature | RESTORE [name]
|
Permission | CREATE |
Summary | Restores a database with the specified [name] . The name may include the timestamp of the backup file.
|
Errors | The command fails if the specified backup does not exist, if the database to be restored is currently locked, or if it could not be restored for some other reason. |
RUN
Signature | RUN [file]
|
Permission | depends on query |
Summary | Runs the query contained in [file] and prints the result.
|
Errors | The command fails if the specified file does not exist, or if the retrieved query is invalid. |
SET
Signature | SET [option] ([value])
|
Permission | READ |
Summary | Sets an [option] to the specified [value] . A list of all options is available here.
|
Errors | The command fails if the specified option is unknown or if the specified value is invalid. |
SHOW BACKUPS
Signature | SHOW BACKUPS
|
Permission | CREATE |
Summary | Shows all database backups. |
SHOW DATABASES
Signature | SHOW DATABASES
|
Permission | ADMIN |
Summary | Shows all databases that are opened in the current server instance. |
SHOW SESSIONS
Signature | SHOW SESSIONS
|
Permission | ADMIN |
Summary | Shows all sessions that are connected to the current server instance. |
SHOW EVENTS
Signature | SHOW EVENTS
|
Permission | ADMIN |
Summary | Shows all events that have been registered in the database. |
SHOW USERS
Signature | SHOW USERS (ON [database])
|
Permission | ADMIN |
Summary | Shows all users that are registered in the database. If a [database] is specified, local users are shown.
|
Errors | The command fails if the optional database could not be opened. |
XQUERY
Signature | XQUERY [query]
|
Permission | depends on query |
Summary | Runs the specified [query] and prints the result.
|
Errors | The command fails if the specified query is invalid. |
Examples |
|