Difference between revisions of "Commands"
m (Text replace - "| valign='top' | " to "| ") |
|||
Line 18: | Line 18: | ||
|<code>CREATE DATABASE [name] ([input])</code> | |<code>CREATE DATABASE [name] ([input])</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''CREATE'' | |''CREATE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Creates the database <code>[name]</code> with an optional <code>[input]</code>.<br />The input may either be a reference to a single XML document, a directory, a remote URL, or a string containing XML. <code>[name]</code> must be a [[#Valid Names|valid database name]]. | |Creates the database <code>[name]</code> with an optional <code>[input]</code>.<br />The input may either be a reference to a single XML document, a directory, a remote URL, or a string containing XML. <code>[name]</code> must be a [[#Valid Names|valid database name]]. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if a database with the specified name is currently used by another process, if one of the documents to be added is not well-formed or if it cannot be parsed for some other reason. | |The command fails if a database with the specified name is currently used by another process, if one of the documents to be added is not well-formed or if it cannot be parsed for some other reason. | ||
|- | |- | ||
− | + | | '''Examples''' | |
| | | | ||
* <code>CREATE DATABASE input</code><br/>creates an empty database <code>input</code>. | * <code>CREATE DATABASE input</code><br/>creates an empty database <code>input</code>. | ||
Line 41: | Line 41: | ||
|<code>OPEN [path]</code> | |<code>OPEN [path]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''READ'' | |''READ'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Opens a database or some of its documents. <code>[path]</code> is the name of the database. If the name is further refined by a path, only some of the documents in the database will be opened. | |Opens a database or some of its documents. <code>[path]</code> is the name of the database. If the name is further refined by a path, only some of the documents in the database will be opened. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if the specified database does not exist, is currently being updated by another process, cannot be opened for some other reason. | |The command fails if the specified database does not exist, is currently being updated by another process, cannot be opened for some other reason. | ||
|} | |} | ||
Line 57: | Line 57: | ||
|<code>CHECK [input]</code> | |<code>CHECK [input]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''READ/CREATE'' | |''READ/CREATE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|This command combines [[#OPEN|OPEN]] and [[#CREATE DATABASE|CREATE DATABASE]]: if a database with the name {{Mono|[input]}} exists, it is opened. Otherwise, it creates a new database and stores the specified input as initial content. | |This command combines [[#OPEN|OPEN]] and [[#CREATE DATABASE|CREATE DATABASE]]: if a database with the name {{Mono|[input]}} exists, it is opened. Otherwise, it creates a new database and stores the specified input as initial content. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if the addressed database could neither be opened nor created. | |The command fails if the addressed database could neither be opened nor created. | ||
|} | |} | ||
Line 73: | Line 73: | ||
|<code>CLOSE </code> | |<code>CLOSE </code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''READ'' | |''READ'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Closes the currently opened database. | |Closes the currently opened database. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if the database files could not be closed for some reason. | |The command fails if the database files could not be closed for some reason. | ||
|} | |} | ||
Line 89: | Line 89: | ||
|<code>EXPORT [path]</code> | |<code>EXPORT [path]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''CREATE'' | |''CREATE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Exports all documents in the database to the specified <code>[path]</code>, using the serializer options specified by the <code>[[Options#EXPORTER|EXPORTER]]</code> option. | |Exports all documents in the database to the specified <code>[path]</code>, using the serializer options specified by the <code>[[Options#EXPORTER|EXPORTER]]</code> 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 are invalid, or if the documents cannot be serialized for some other reason. | |The command fails if no database is opened, if the target path points to a file or is invalid, if the serialization parameters are invalid, or if the documents cannot be serialized for some other reason. | ||
|} | |} | ||
Line 107: | Line 107: | ||
|<code>CREATE INDEX [TEXT|ATTRIBUTE|FULLTEXT]</code> | |<code>CREATE INDEX [TEXT|ATTRIBUTE|FULLTEXT]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''WRITE'' | |''WRITE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Creates the specified database [[Indexes|index]]. | |Creates the specified database [[Indexes|index]]. | ||
|- | |- | ||
− | + | | '''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. | ||
|} | |} | ||
Line 125: | Line 125: | ||
|<code>DROP INDEX [TEXT|ATTRIBUTE|FULLTEXT]</code> | |<code>DROP INDEX [TEXT|ATTRIBUTE|FULLTEXT]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''WRITE'' | |''WRITE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Drops the specified database [[Indexes|index]]. | |Drops the specified database [[Indexes|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. | |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. | ||
|} | |} | ||
Line 143: | Line 143: | ||
|<code>ALTER DATABASE [name] [newname]</code> | |<code>ALTER DATABASE [name] [newname]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''CREATE'' | |''CREATE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Renames the database specified by <code>[name]</code> to <code>[newname]</code>. <code>[newname]</code> must be a [[#Valid Names|valid database name]]. | |Renames the database specified by <code>[name]</code> to <code>[newname]</code>. <code>[newname]</code> must be a [[#Valid Names|valid database name]]. | ||
|- | |- | ||
− | + | | '''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. | |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''' | |
| | | | ||
* <code>ALTER DATABASE db tempdb</code><br/>renames the database <code>db</code> into <code>tempdb</code>. | * <code>ALTER DATABASE db tempdb</code><br/>renames the database <code>db</code> into <code>tempdb</code>. | ||
Line 163: | Line 163: | ||
|<code>DROP DATABASE [name]</code> | |<code>DROP DATABASE [name]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''CREATE'' | |''CREATE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Drops the database with the specified <code>[name]</code>. The [[#Glob Syntax|Glob Syntax]] can be used to address more than one database. | |Drops the database with the specified <code>[name]</code>. The [[#Glob Syntax|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. | |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. | ||
|} | |} | ||
Line 179: | Line 179: | ||
|<code>CREATE BACKUP [name]</code> | |<code>CREATE BACKUP [name]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''CREATE'' | |''CREATE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Creates a zipped backup of the database specified by {{Mono|[name]}}. The backup file will be suffixed with the current timestamp and stored in the database directory. The [[#Glob Syntax|Glob Syntax]] can be used to address more than one database. | |Creates a zipped backup of the database specified by {{Mono|[name]}}. The backup file will be suffixed with the current timestamp and stored in the database directory. The [[#Glob Syntax|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. | |The command fails if the specified database does not exist, or if it could not be zipped for some other reason. | ||
|- | |- | ||
− | + | | '''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 the [[Configuration#Database_Directory|database directory]]. | * <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 the [[Configuration#Database_Directory|database directory]]. | ||
Line 199: | Line 199: | ||
|<code>RESTORE [name]</code> | |<code>RESTORE [name]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''CREATE'' | |''CREATE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Restores a database with the specified <code>[name]</code>. The name may include the timestamp of the backup file. | |Restores a database with the specified <code>[name]</code>. 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. | |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. | ||
|} | |} | ||
Line 215: | Line 215: | ||
|<code>DROP BACKUP [name]</code> | |<code>DROP BACKUP [name]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''CREATE'' | |''CREATE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Drops all backups of the database with the specified <code>[name]</code>. The [[#Glob Syntax|Glob Syntax]] can be used to address more than one database. | |Drops all backups of the database with the specified <code>[name]</code>. The [[#Glob Syntax|Glob Syntax]] can be used to address more than one database. | ||
|- | |- | ||
− | + | | '''Examples''' | |
| | | | ||
* <code>DROP BACKUP abc*</code><br/>deletes the backups of all databases starting with the characters <code>abc</code>. | * <code>DROP BACKUP abc*</code><br/>deletes the backups of all databases starting with the characters <code>abc</code>. | ||
Line 232: | Line 232: | ||
|<code>SHOW BACKUPS</code> | |<code>SHOW BACKUPS</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''CREATE'' | |''CREATE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Shows all database backups. | |Shows all database backups. | ||
|} | |} | ||
Line 245: | Line 245: | ||
|<code>COPY [name] [newname]</code> | |<code>COPY [name] [newname]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''CREATE'' | |''CREATE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Creates a copy of the database specified by <code>[name]</code>. <code>[newname]</code> must be a [[#Valid Names|valid database name]]. | |Creates a copy of the database specified by <code>[name]</code>. <code>[newname]</code> must be a [[#Valid Names|valid database name]]. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|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. | ||
|} | |} | ||
Line 261: | Line 261: | ||
|<code>INFO DATABASE</code> | |<code>INFO DATABASE</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''READ'' | |''READ'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Shows information on the currently opened database. | |Shows information on the currently opened database. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if no database is opened. | |The command fails if no database is opened. | ||
|} | |} | ||
Line 277: | Line 277: | ||
|<code>INFO INDEX ([TEXT|ATTRIBUTE|FULLTEXT|PATH])</code> | |<code>INFO INDEX ([TEXT|ATTRIBUTE|FULLTEXT|PATH])</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''READ'' | |''READ'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Shows information on the existing [[Indexes|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. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if no database is opened, or if the specified index is unknown. | |The command fails if no database is opened, or if the specified index is unknown. | ||
|} | |} | ||
Line 293: | Line 293: | ||
| <code>INFO STORAGE [start end] | [query]</code> | | <code>INFO STORAGE [start end] | [query]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''READ'' | |''READ'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Shows the internal main table of the currently opened database. An integer range or a query may be specified as argument. | |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. | |The command fails if no database is opened, or if one of the specified arguments is invalid. | ||
|} | |} | ||
Line 311: | Line 311: | ||
|<code>LIST ([path])</code> | |<code>LIST ([path])</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''NONE'' | |''NONE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Lists all available databases, or the documents in a database. <code>[path]</code> is the name of the database, optionally followed by a path to the requested documents. | |Lists all available databases, or the documents in a database. <code>[path]</code> 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. | |The command fails if the optional database cannot be opened, or if the existing databases cannot be listed for some other reason. | ||
|} | |} | ||
Line 327: | Line 327: | ||
|<code>XQUERY [query]</code> | |<code>XQUERY [query]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''depends on query'' | |''depends on query'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Runs the specified <code>[query]</code> and prints the result. | |Runs the specified <code>[query]</code> and prints the result. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if the specified query is invalid. | |The command fails if the specified query is invalid. | ||
|- | |- | ||
− | + | | '''Examples''' | |
| | | | ||
* <code>XQUERY 1 to 10</code><br/>returns the sequence <code>(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)</code>. | * <code>XQUERY 1 to 10</code><br/>returns the sequence <code>(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)</code>. | ||
Line 349: | Line 349: | ||
|<code>RETRIEVE [path] [input]</code> | |<code>RETRIEVE [path] [input]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''READ'' | |''READ'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Retrieves raw data from the specified database <code>[path]</code>. | |Retrieves raw data from the specified database <code>[path]</code>. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if no database is opened, if the source path is invalid or if the data cannot not be retrieved for some other reason. | |The command fails if no database is opened, if the source path is invalid or if the data cannot not be retrieved for some other reason. | ||
|} | |} | ||
Line 365: | Line 365: | ||
|<code>RUN [file]</code> | |<code>RUN [file]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''depends on query'' | |''depends on query'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Runs the query contained in <code>[file]</code> and prints the result. | |Runs the query contained in <code>[file]</code> and prints the result. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if the specified file does not exist, or if the retrieved query is invalid. | |The command fails if the specified file does not exist, or if the retrieved query is invalid. | ||
|} | |} | ||
Line 381: | Line 381: | ||
|<code>FIND [keywords]</code> | |<code>FIND [keywords]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''READ'' | |''READ'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Builds and runs a query for the specified <code>[keywords]</code>. Keywords can be enclosed in quotes to look for phrases. The following modifiers can be used to further limit search: | |Builds and runs a query for the specified <code>[keywords]</code>. Keywords can be enclosed in quotes to look for phrases. The following modifiers can be used to further limit search: | ||
<code>= </code> looks for exact text nodes<br/><code>~ </code> looks for approximate hits<br/><code>@=</code> looks for exact attribute values<br/><code>@ </code> looks for attributes | <code>= </code> looks for exact text nodes<br/><code>~ </code> looks for approximate hits<br/><code>@=</code> looks for exact attribute values<br/><code>@ </code> looks for attributes | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if no database is opened. | |The command fails if no database is opened. | ||
|} | |} | ||
Line 398: | Line 398: | ||
|<code>CS [query]</code> | |<code>CS [query]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''depends on query'' | |''depends on query'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Evaluates the specified <code>[query]</code> and sets the result as new context set. | |Evaluates the specified <code>[query]</code> 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. | |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. | ||
|} | |} | ||
Line 414: | Line 414: | ||
|<code>REPO INSTALL [path]</code> | |<code>REPO INSTALL [path]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''CREATE'' ({{Mark|before Version 7.2}}: ''ADMIN'') | |''CREATE'' ({{Mark|before Version 7.2}}: ''ADMIN'') | ||
|- | |- | ||
− | + | | '''Summary''' | |
| Installs the package with path <code>[path]</code>. | | Installs the package with path <code>[path]</code>. | ||
|- | |- | ||
− | + | | '''Errors''' | |
| The command fails in the following cases: | | The command fails in the following cases: | ||
* The package to be installed is not a xar file. | * The package to be installed is not a xar file. | ||
Line 436: | Line 436: | ||
|<code>REPO LIST</code> | |<code>REPO LIST</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''READ'' ({{Mark|before Version 7.2}}: ''ADMIN'') | |''READ'' ({{Mark|before Version 7.2}}: ''ADMIN'') | ||
|- | |- | ||
− | + | | '''Summary''' | |
| Lists all installed packages. | | Lists all installed packages. | ||
|} | |} | ||
Line 449: | Line 449: | ||
|<code>REPO DELETE [name|dir]</code> | |<code>REPO DELETE [name|dir]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''CREATE'' ({{Mark|before Version 7.2}}: ''ADMIN'') | |''CREATE'' ({{Mark|before Version 7.2}}: ''ADMIN'') | ||
|- | |- | ||
− | + | | '''Summary''' | |
| Deletes the package with name <code>[name]</code> or with directory <code>[dir]</code>. | | Deletes the package with name <code>[name]</code> or with directory <code>[dir]</code>. | ||
|- | |- | ||
− | + | | '''Errors''' | |
| The command fails if the package to be deleted participates in a dependency. | | The command fails if the package to be deleted participates in a dependency. | ||
|} | |} | ||
Line 467: | Line 467: | ||
|<code>ADD (TO [path]) [input]</code> | |<code>ADD (TO [path]) [input]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''WRITE'' | |''WRITE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Adds the files, directory or XML string specified by <code>[input]</code> to the currently opened database at the specified <code>[path]</code>.<br/><code>[input]</code> may either be a single XML document, a directory, a remote URL or a plain XML string. If the path denotes a directory, it needs to be suffixed with a slash (<code>/</code>). | |Adds the files, directory or XML string specified by <code>[input]</code> to the currently opened database at the specified <code>[path]</code>.<br/><code>[input]</code> may either be a single XML document, a directory, a remote URL or a plain XML string. If the path denotes a directory, it needs to be suffixed with a slash (<code>/</code>). | ||
|- | |- | ||
− | + | | '''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. | |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''' | |
| | | | ||
* <code>ADD input.xml</code><br/>adds the file <code>input.xml</code> to the database. | * <code>ADD input.xml</code><br/>adds the file <code>input.xml</code> to the database. | ||
Line 489: | Line 489: | ||
|<code>DELETE [path]</code> | |<code>DELETE [path]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''WRITE'' | |''WRITE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Deletes all documents from the currently opened database that start with the specified <code>[path]</code>. | |Deletes all documents from the currently opened database that start with the specified <code>[path]</code>. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if no database is opened. | |The command fails if no database is opened. | ||
|} | |} | ||
Line 505: | Line 505: | ||
|<code>RENAME [path] [newpath]</code> | |<code>RENAME [path] [newpath]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''WRITE'' | |''WRITE'' | ||
|- | |- | ||
− | + | | '''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. | |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. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if no database is opened, or if the target path is empty. | |The command fails if no database is opened, or if the target path is empty. | ||
|- | |- | ||
− | + | | '''Examples''' | |
| | | | ||
* <code>RENAME one.xml two.xml</code><br/>renames the document <code>one.xml</code> to <code>two.xml</code>. | * <code>RENAME one.xml two.xml</code><br/>renames the document <code>one.xml</code> to <code>two.xml</code>. | ||
Line 526: | Line 526: | ||
|<code>REPLACE [path] [input]</code> | |<code>REPLACE [path] [input]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''WRITE'' | |''WRITE'' | ||
|- | |- | ||
− | + | | '''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. | |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. | ||
|- | |- | ||
− | + | | '''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. | |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''' | |
| | | | ||
* <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 one.xml input.xml</code><br/>replaces the document <code>one.xml</code> with the contents of the file <code>input.xml</code>. | ||
Line 547: | Line 547: | ||
|<code>STORE (TO [path]) [input]</code> | |<code>STORE (TO [path]) [input]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''WRITE'' | |''WRITE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Stores raw data to the specified <code>[path]</code>. <code>[input]</code> may either be a file reference, a remote URL, or a plain string. If the path denotes a directory, it needs to be suffixed with a slash (<code>/</code>). | |Stores raw data to the specified <code>[path]</code>. <code>[input]</code> may either be a file reference, a remote URL, or a plain string. If the path denotes a directory, it needs to be suffixed with a slash (<code>/</code>). | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if no database is opened, if the specified resource is not found, if the target path is invalid or if the data cannot not be written for some other reason. | |The command fails if no database is opened, if the specified resource is not found, if the target path is invalid or if the data cannot not be written for some other reason. | ||
|} | |} | ||
Line 563: | Line 563: | ||
|<code>OPTIMIZE (ALL)</code> | |<code>OPTIMIZE (ALL)</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''WRITE'' | |''WRITE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Optimizes the index structures, meta data and statistics of the currently opened database. If the {{Mono|ALL}} flag is specified, the internal database structures are completely rebuilt; this often leads to a reduction of the total database size. | |Optimizes the index structures, meta data and statistics of the currently opened database. If the {{Mono|ALL}} flag is specified, the internal database structures are completely rebuilt; this often leads to a reduction of the total database size. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if no database is opened, or if the currently opened database is a main-memory instance. | |The command fails if no database is opened, or if the currently opened database is a main-memory instance. | ||
|} | |} | ||
Line 579: | Line 579: | ||
|<code>FLUSH</code> | |<code>FLUSH</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''WRITE'' | |''WRITE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Explicitly flushes the buffers of the currently opened database to disk. This command is applied if the [[Options#AUTOFLUSH|AUTOFLUSH]] option has been set to false. | |Explicitly flushes the buffers of the currently opened database to disk. This command is applied if the [[Options#AUTOFLUSH|AUTOFLUSH]] option has been set to false. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if no database is opened. | |The command fails if no database is opened. | ||
|} | |} | ||
Line 597: | Line 597: | ||
|<code>SHOW DATABASES</code> | |<code>SHOW DATABASES</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''ADMIN'' | |''ADMIN'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Shows all databases that are opened in the current server instance. | |Shows all databases that are opened in the current server instance. | ||
|} | |} | ||
Line 610: | Line 610: | ||
|<code>SHOW SESSIONS</code> | |<code>SHOW SESSIONS</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''ADMIN'' | |''ADMIN'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Shows all sessions that are connected to the current server instance. | |Shows all sessions that are connected to the current server instance. | ||
|} | |} | ||
Line 623: | Line 623: | ||
|<code>SHOW USERS (ON [database])</code> | |<code>SHOW USERS (ON [database])</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''ADMIN'' | |''ADMIN'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Shows all users that are registered in the database. If a <code>[database]</code> is specified, local users are shown. | |Shows all users that are registered in the database. If a <code>[database]</code> is specified, local users are shown. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if the optional database could not be opened. | |The command fails if the optional database could not be opened. | ||
|} | |} | ||
Line 639: | Line 639: | ||
|<code>KILL [target]</code> | |<code>KILL [target]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''ADMIN'' | |''ADMIN'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Kills sessions of a user or an IP:port combination, specified by <code>[target]</code>. The [[#Glob Syntax|Glob Syntax]] can be used to address more than one user. | |Kills sessions of a user or an IP:port combination, specified by <code>[target]</code>. The [[#Glob Syntax|Glob Syntax]] can be used to address more than one user. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if a user tried to kill his/her own session. | |The command fails if a user tried to kill his/her own session. | ||
|} | |} | ||
Line 655: | Line 655: | ||
|<code>CREATE EVENT [NAME]</code> | |<code>CREATE EVENT [NAME]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''ADMIN'' | |''ADMIN'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Creates the specified [[Events|event]]. | |Creates the specified [[Events|event]]. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if event already exists. | |The command fails if event already exists. | ||
|} | |} | ||
Line 671: | Line 671: | ||
|<code>SHOW EVENTS</code> | |<code>SHOW EVENTS</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''ADMIN'' | |''ADMIN'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Shows all [[Events|events]] that have been registered in the database. | |Shows all [[Events|events]] that have been registered in the database. | ||
|} | |} | ||
Line 684: | Line 684: | ||
|<code>DROP EVENT [NAME]</code> | |<code>DROP EVENT [NAME]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''ADMIN'' | |''ADMIN'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Drops the specified [[Events|event]]. | |Drops the specified [[Events|event]]. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if the event doesn't exist. | |The command fails if the event doesn't exist. | ||
|} | |} | ||
Line 702: | Line 702: | ||
|<code>CREATE USER [name] ([password])</code> | |<code>CREATE USER [name] ([password])</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''ADMIN'' | |''ADMIN'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Creates a user with the specified <code>[name]</code> and <code>[password]</code>. <code>[name]</code> must be a [[#Valid Names|valid user name]]. The password must be a valid MD5 hash value. If no password is specified in the console mode, it is requested via standard input. | |Creates a user with the specified <code>[name]</code> and <code>[password]</code>. <code>[name]</code> must be a [[#Valid Names|valid user name]]. The password must be a valid MD5 hash value. 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 the password is no valid MD5 hash value. | |The command fails if the specified user already exists, or if the password is no valid MD5 hash value. | ||
|} | |} | ||
Line 718: | Line 718: | ||
|<code>ALTER USER [name] ([password])</code> | |<code>ALTER USER [name] ([password])</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''ADMIN'' | |''ADMIN'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Alters the <code>[password]</code> of the user specified by <code>[name]</code>. The password must be a valid MD5 hash value. If no password is specified in the console mode, it is requested via standard input. | |Alters the <code>[password]</code> of the user specified by <code>[name]</code>. The password must be a valid MD5 hash value. 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 the password is no valid MD5 hash value. | |The command fails if the specified user does not exist, or if the password is no valid MD5 hash value. | ||
|} | |} | ||
Line 734: | Line 734: | ||
|<code>DROP USER [name] (ON [database])</code>: | |<code>DROP USER [name] (ON [database])</code>: | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''ADMIN'' | |''ADMIN'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|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|Glob Syntax]] can be used to address more than one database or user. | |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|Glob Syntax]] can be used to address more than one database or user. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if <code>admin</code> 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. | |The command fails if <code>admin</code> 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. | ||
|} | |} | ||
Line 750: | Line 750: | ||
|<code>GRANT [NONE|READ|WRITE|CREATE|ADMIN] (ON [database]) TO [user]</code> | |<code>GRANT [NONE|READ|WRITE|CREATE|ADMIN] (ON [database]) TO [user]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''ADMIN'' | |''ADMIN'' | ||
|- | |- | ||
− | + | | '''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 [[#Glob Syntax|Glob Syntax]] can be used to address more than one database or user. | |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|Glob Syntax]] can be used to address more than one database or user. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|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. | |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. | ||
|- | |- | ||
− | + | | '''Examples''' | |
| | | | ||
* <code>GRANT READ TO JoeWinson</code><br/>grants <code>READ</code> permission to the user <code>JoeWinson</code>. | * <code>GRANT READ TO JoeWinson</code><br/>grants <code>READ</code> permission to the user <code>JoeWinson</code>. | ||
Line 771: | Line 771: | ||
|<code>PASSWORD ([password])</code> | |<code>PASSWORD ([password])</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''NONE'' | |''NONE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Changes the <code>[password]</code> of the current user. The password must be a valid MD5 hash value. If no password is specified in the console mode, it is requested via standard input. | |Changes the <code>[password]</code> of the current user. The password must be a valid MD5 hash value. If no password is specified in the console mode, it is requested via standard input. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if the password is no valid MD5 hash value. | |The command fails if the password is no valid MD5 hash value. | ||
|} | |} | ||
Line 790: | Line 790: | ||
|<code>GET [option]</code> | |<code>GET [option]</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''NONE'' | |''NONE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Returns the current value of the [[Options|Option]] specified via {{Mono|[key]}}. | |Returns the current value of the [[Options|Option]] specified via {{Mono|[key]}}. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if the specified option is unknown. | |The command fails if the specified option is unknown. | ||
|} | |} | ||
Line 807: | Line 807: | ||
|<code>SET [option] ([value])</code> | |<code>SET [option] ([value])</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''NONE'' | |''NONE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Sets the [[Options|Option]] with the specified <code>[key]</code> to a new <code>[value]</code>. If no value is specified, and if the value is boolean, it will be inverted. | |Sets the [[Options|Option]] with the specified <code>[key]</code> to a new <code>[value]</code>. If no value is specified, and if the value is boolean, it will be inverted. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|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. | ||
|} | |} | ||
Line 823: | Line 823: | ||
|<code>INFO</code> | |<code>INFO</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''READ'' | |''READ'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Shows global information. | |Shows global information. | ||
|} | |} | ||
Line 836: | Line 836: | ||
|<code>HELP ([command])</code> | |<code>HELP ([command])</code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''NONE'' | |''NONE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|If <code>[command]</code> is specified, information on the specific command is printed; otherwise, all commands are listed. | |If <code>[command]</code> is specified, information on the specific command is printed; otherwise, all commands are listed. | ||
|- | |- | ||
− | + | | '''Errors''' | |
|The command fails if the specified command is unknown. | |The command fails if the specified command is unknown. | ||
|} | |} | ||
Line 852: | Line 852: | ||
|<code>EXIT </code> | |<code>EXIT </code> | ||
|- | |- | ||
− | + | | '''Permission''' | |
|''NONE'' | |''NONE'' | ||
|- | |- | ||
− | + | | '''Summary''' | |
|Exits the console mode. | |Exits the console mode. | ||
|} | |} |
Revision as of 00:42, 26 May 2012
This article is linked from the Getting Started Section.
It lists all database commands supported by BaseX.
Commands can e.g. be run from the Command Line,
the Clients, REST, the input field in the GUI, and in numerous
other ways. If the GUI is used, all commands that are triggered by the GUI itself
will show up in the Info View.
The Permission fields 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
Database Operations
CREATE DATABASE
Signature | CREATE DATABASE [name] ([input])
|
Permission | CREATE |
Summary | Creates the database [name] with an optional [input] .The input may either be a reference to a single XML document, a directory, a remote URL, or a string containing XML. [name] must be a valid database name.
|
Errors | The command fails if a database with the specified name is currently used by another process, if one of the documents to be added is not well-formed or if it cannot be parsed for some other reason. |
Examples |
|
OPEN
Signature | OPEN [path]
|
Permission | READ |
Summary | Opens a database or some of its documents. [path] is the name of the database. If the name is further refined by a path, only some of the documents in the database will be opened.
|
Errors | The command fails if the specified database does not exist, is currently being updated by another process, cannot be opened for some other reason. |
CHECK
Signature | CHECK [input]
|
Permission | READ/CREATE |
Summary | This command combines OPEN and CREATE DATABASE: if a database with the name [input] exists, it is opened. Otherwise, it creates a new database and stores the specified input as initial content.
|
Errors | The command fails if the addressed database could neither be opened nor created. |
CLOSE
Signature | CLOSE
|
Permission | READ |
Summary | Closes the currently opened database. |
Errors | The command fails if the database files could not be closed for some reason. |
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 are invalid, or if the documents cannot be serialized for some other reason. |
CREATE INDEX
Template:Mark PATH
removed as argument; path summary is now updated by OPTIMIZE command
Signature | CREATE INDEX [TEXT|ATTRIBUTE|FULLTEXT]
|
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. |
DROP INDEX
Template:Mark PATH
removed as argument; path summary is now always available
Signature | DROP INDEX [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. |
Administration
ALTER DATABASE
Signature | ALTER DATABASE [name] [newname]
|
Permission | CREATE |
Summary | Renames the database specified by [name] to [newname] . [newname] must be a valid database name.
|
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 |
|
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. |
CREATE BACKUP
Signature | CREATE BACKUP [name]
|
Permission | CREATE |
Summary | Creates a zipped backup of the database specified by [name] . 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 |
|
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. |
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 |
|
SHOW BACKUPS
Signature | SHOW BACKUPS
|
Permission | CREATE |
Summary | Shows all database backups. |
COPY
Signature | COPY [name] [newname]
|
Permission | CREATE |
Summary | Creates a copy of the database specified by [name] . [newname] must be a valid database name.
|
Errors | The command fails if the target database already exists, or if the source database does not exist. |
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. |
Querying
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. |
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 |
|
RETRIEVE
Signature | RETRIEVE [path] [input]
|
Permission | READ |
Summary | Retrieves raw data from the specified database [path] .
|
Errors | The command fails if no database is opened, if the source path is invalid or if the data cannot not be retrieved 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. |
FIND
Signature | FIND [keywords]
|
Permission | READ |
Summary | Builds and runs a query for the specified [keywords] . Keywords can be enclosed in quotes to look for phrases. The following modifiers can be used to further limit search:
|
Errors | The command fails if no database is opened. |
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. |
REPO INSTALL
Signature | REPO INSTALL [path]
|
Permission | CREATE (Template:Mark: ADMIN) |
Summary | Installs the package with path [path] .
|
Errors | The command fails in the following cases:
|
REPO LIST
Signature | REPO LIST
|
Permission | READ (Template:Mark: ADMIN) |
Summary | Lists all installed packages. |
REPO DELETE
Signature | REPO DELETE [name|dir]
|
Permission | CREATE (Template:Mark: 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. |
Updates
ADD
Signature | ADD (TO [path]) [input]
|
Permission | WRITE |
Summary | Adds the files, directory or XML string specified by [input] to the currently opened database at the specified [path] .[input] may either be a single XML document, a directory, a remote URL or a plain XML string. If the path denotes a directory, it needs to be suffixed with a slash (/ ).
|
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 |
|
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. |
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 |
|
STORE
Signature | STORE (TO [path]) [input]
|
Permission | WRITE |
Summary | Stores raw data to the specified [path] . [input] may either be a file reference, a remote URL, or a plain string. If the path denotes a directory, it needs to be suffixed with a slash (/ ).
|
Errors | The command fails if no database is opened, if the specified resource is not found, if the target path is invalid or if the data cannot not be written for some other reason. |
OPTIMIZE
Signature | OPTIMIZE (ALL)
|
Permission | WRITE |
Summary | Optimizes the index structures, meta data and statistics of the currently opened database. If the ALL flag is specified, the internal database structures are completely rebuilt; this often leads to a reduction of the total database size.
|
Errors | The command fails if no database is opened, or if the currently opened database is a main-memory instance. |
FLUSH
Signature | FLUSH
|
Permission | WRITE |
Summary | Explicitly flushes the buffers of the currently opened database to disk. This command is applied if the AUTOFLUSH option has been set to false. |
Errors | The command fails if no database is opened. |
Server Administration
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 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. |
KILL
Signature | KILL [target]
|
Permission | ADMIN |
Summary | Kills sessions of a user or an IP:port combination, specified by [target] . The Glob Syntax can be used to address more than one user.
|
Errors | The command fails if a user tried to kill his/her own session. |
CREATE EVENT
Signature | CREATE EVENT [NAME]
|
Permission | ADMIN |
Summary | Creates the specified event. |
Errors | The command fails if event already exists. |
SHOW EVENTS
Signature | SHOW EVENTS
|
Permission | ADMIN |
Summary | Shows all events that have been registered in the database. |
DROP EVENT
Signature | DROP EVENT [NAME]
|
Permission | ADMIN |
Summary | Drops the specified event. |
Errors | The command fails if the event doesn't exist. |
User Management
CREATE USER
Signature | CREATE USER [name] ([password])
|
Permission | ADMIN |
Summary | Creates a user with the specified [name] and [password] . [name] must be a valid user name. The password must be a valid MD5 hash value. 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 the password is no valid MD5 hash value. |
ALTER USER
Signature | ALTER USER [name] ([password])
|
Permission | ADMIN |
Summary | Alters the [password] of the user specified by [name] . The password must be a valid MD5 hash value. 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 the password is no valid MD5 hash value. |
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.
|
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 |
|
PASSWORD
Signature | PASSWORD ([password])
|
Permission | NONE |
Summary | Changes the [password] of the current user. The password must be a valid MD5 hash value. If no password is specified in the console mode, it is requested via standard input.
|
Errors | The command fails if the password is no valid MD5 hash value. |
General Commands
GET
Template:Mark permission changed from READ
to NONE
Signature | GET [option]
|
Permission | NONE |
Summary | Returns the current value of the Option specified via [key] .
|
Errors | The command fails if the specified option is unknown. |
SET
Template:Mark permission changed from READ
to NONE
Signature | SET [option] ([value])
|
Permission | NONE |
Summary | Sets the Option with the specified [key] to a new [value] . If no value is specified, and if the value is boolean, it will be inverted.
|
Errors | The command fails if the specified option is unknown or if the specified value is invalid. |
INFO
Signature | INFO
|
Permission | READ |
Summary | Shows global information. |
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. |
EXIT
Signature | EXIT
|
Permission | NONE |
Summary | Exits the console mode. |
Conventions
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
.
Valid Names
Both database and user names must follow the same naming constraints. Valid names may contain letters, numbers, underscores and dashes. Names must have at least one character; they also should not be longer than 128 characters, although this is not enforced. A regular expression matching valid names is [-_a-zA-Z0-9]{1,128}
.
Shortcuts
In all commands, the DATABASE
keyword can be replaced by the shortcut DB
.
Changelog
Version 7.2.1
Version 7.2
- Updated:
CREATE INDEX
,DROP INDEX
(PATH
argument removed. Path summary is always available now and updated with OPTIMIZE) - Updated: permissions for
REPO DELETE
,REPO INSTALL
andREPO LIST
Version 7.1
- Updated:
KILL
(killing sessions by specifying IP:port)