Changes

Jump to navigation Jump to search
5,274 bytes added ,  19:46, 30 June 2011
no edit summary
A shortcut exists for some of the command keywords. For example, you may replace
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==
|-
| valign='top' | '''Permission'''
|Write''WRITE''
|-
| valign='top' | '''Summary'''
|-
| valign='top' | '''Permission'''
|Create''CREATE''
|-
| valign='top' | '''Summary'''
|-
| valign='top' | '''Permission'''
|Admin''ADMIN''
|-
| valign='top' | '''Summary'''
| valign='top' | '''Errors'''
|The command fails if the specified user does not exist, or if no password has been specified.
|}
 
==BACKUP==
{|
|-
| valign='top' width='90' | '''Signature'''
|<code>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.
|-
| 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]] folder.
|}
|-
| valign='top' | '''Permission'''
|Create''CREATE''
|-
| valign='top' | '''Summary'''
|-
| valign='top' | '''Permission'''
|None''NONE''
|-
| valign='top' | '''Summary'''
|-
| valign='top' | '''Permission'''
|Create''CREATE''
|-
| valign='top' | '''Summary'''
|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==
{|
|-
| valign='top' | '''Permission'''
|Create''CREATE''
|-
| valign='top' | '''Summary'''
|-
| valign='top' | '''Permission'''
|Write''WRITE''
|-
| valign='top' | '''Summary'''
|Creates the specified database [[Indexes|index]].
|-
| 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.
|}
 
==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==
{|
|-
| valign='top' | '''Permission'''
|Admin''ADMIN''
|-
| valign='top' | '''Summary'''
|-
| valign='top' | '''Permission'''
|Write''WRITE''
|-
| valign='top' | '''Summary'''
|-
| valign='top' | '''Permission'''
|Create''CREATE''
|-
| valign='top' | '''Summary'''
|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==
{|
|-
| valign='top' | '''Permission'''
|Create''CREATE''
|-
| valign='top' | '''Summary'''
|Drops the database with the specified <code>[name]</code>. 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 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==
{|
|-
| valign='top' | '''Permission'''
|Write''WRITE''
|-
| valign='top' | '''Summary'''
|Drops the specified database [[Indexes|index]].
|-
| 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.
|}
 
==DROP USER==
{|
|-
| valign='top' | '''Permission'''
|Admin''ADMIN''
|-
| 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 default <code>admin</code> user Glob syntax can never be droppedused to address more than one database or user.
|-
| valign='top' | '''Errors'''
|-
| valign='top' | '''Permission'''
|None''NONE''
|-
| valign='top' | '''Summary'''
|-
| valign='top' | '''Permission'''
|Create''CREATE''
|-
| valign='top' | '''Summary'''
|-
| valign='top' | '''Permission'''
|Read''READ''
|-
| valign='top' | '''Summary'''
|-
| valign='top' | '''Permission'''
|None''READ''
|-
| valign='top' | '''Summary'''
|The command fails if the specified option is unknown.
|}
 
==GRANT==
{|
|-
| valign='top' | '''Permission'''
|Admin''ADMIN''
|-
| 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 permissions of the <code>admin</code> Glob syntax can be used to address more than one database or user cannot be modified.
|-
| valign='top' | '''Errors'''
|The command fails if <code>admin</code> is specified as user name, if the specified index is unknown, 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>.
|}
|-
| valign='top' | '''Permission'''
|None''NONE''
|-
| valign='top' | '''Summary'''
|-
| valign='top' | '''Permission'''
|Read''READ''
|-
| valign='top' | '''Summary'''
|-
| valign='top' | '''Permission'''
|Read''READ''
|-
| valign='top' | '''Summary'''
|-
| valign='top' | '''Permission'''
|Read''READ''
|-
| valign='top' | '''Summary'''
|Shows information on the existing [[Indexes|index ]] structures. The output can be optionally limited to the specified index.
|-
| valign='top' | '''Errors'''
|-
| valign='top' | '''Permission'''
|Read''READ''
|-
| valign='top' | '''Summary'''
|-
| valign='top' | '''Permission'''
|Admin''ADMIN''
|-
| valign='top' | '''Summary'''
|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' | '''Permission'''
|None''NONE''
|-
| valign='top' | '''Summary'''
|-
| valign='top' | '''Permission'''
|Read''READ''
|-
| valign='top' | '''Summary'''
|-
| valign='top' | '''Permission'''
|Write''WRITE''
|-
| valign='top' | '''Summary'''
|-
| valign='top' | '''Permission'''
|None''NONE''
|-
| valign='top' | '''Summary'''
|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 &lt;xml/&gt;</code><br/>replaces the document <code>top.xml</code> with the document <code>&lt;xml/&gt;</code>.
|}
 
==REPO DELETE==
{|
|-
| valign='top' width='90' | '''Signature'''
|<code>REPO DELETE [name&#124;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==
{|
|-
| valign='top' | '''Permission'''
|Create''CREATE''
|-
| valign='top' | '''Summary'''
|-
| valign='top' | '''Permission'''
|None''READ''
|-
| valign='top' | '''Summary'''
|The command fails if the specified option is unknown or if the specified value is invalid.
|}
 
==SHOW BACKUPS==
{|
|-
| valign='top' | '''Permission'''
|Create''CREATE''
|-
| valign='top' | '''Summary'''
|-
| valign='top' | '''Permission'''
|Admin''ADMIN''
|-
| valign='top' | '''Summary'''
|-
| valign='top' | '''Permission'''
|Admin''ADMIN''
|-
| valign='top' | '''Summary'''
|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==
{|
|-
| valign='top' | '''Permission'''
|Admin''ADMIN''
|-
| valign='top' | '''Summary'''
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu