Difference between revisions of "Commands"
Jump to navigation
Jump to search
(→Set) |
(Wikified the markup) |
||
| Line 1: | Line 1: | ||
| − | + | ||
Here you find a description of all database commands | Here you find a description of all database commands | ||
which you can enter in the console mode, in the Command | which you can enter in the console mode, in the Command | ||
| − | text field in the GUI, or send to the BaseX server: | + | text field in the GUI, or send to the BaseX server: |
==Database Commands== | ==Database Commands== | ||
===Create=== | ===Create=== | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | < | + | ;<code>CREATE [DB|FS|INDEX|USER] [...]</code> |
| − | < | + | :Creates a new database, index or user: |
| − | + | ||
| − | + | ;<code>DB [name] ([input])</code>: | |
| − | + | :creates the database <code>[name]</code> with an optional <code>[input]</code> | |
| − | + | ||
| − | + | ;<code>INDEX [TEXT|ATTRIBUTE|FULLTEXT|PATH]</code>: | |
| − | + | :creates the specified index | |
| − | + | ||
| − | + | ;<code>FS [name] [path] ([mountpoint] [backingstore])</code>: | |
| − | + | :creates filesystem database <code>[name]</code> for <code>[path]</code> (using <code>[mountpoint]</code> and <code>[backingstore]</code> if FUSE is activated) | |
| − | + | ||
| − | + | ;<code>USER [name] ([password])</code>: | |
| − | + | :creates the specified user | |
| − | + | ||
| + | |||
===Open=== | ===Open=== | ||
| − | + | ||
| − | <code>OPEN [name]</code> | + | ;<code>OPEN [name]</code> |
| − | Opens the specified database [name]. | + | :Opens the specified database [name]. |
| − | + | ||
===Add=== | ===Add=== | ||
| − | + | ||
| − | <code>ADD (AS [name]) (TO [target]) [input]</code> | + | ;<code>ADD (AS [name]) (TO [target]) [input]</code> |
| − | Adds [input] as [name] to the database, using an optional | + | :Adds [input] as [name] to the database, using an optional [target] path. |
| − | [target] path. | + | |
| − | |||
===Delete=== | ===Delete=== | ||
| − | + | ||
| − | <code>DELETE [name]</code> | + | ;<code>DELETE [name]</code> |
| − | Deletes a document from the current database. | + | :Deletes a document from the current database. |
| − | + | ||
===Info=== | ===Info=== | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | < | + | ;<code>INFO ([DB|INDEX|TABLE])</code> |
| − | < | + | ;Shows information on the currently opened database: |
| − | + | ||
| − | + | * <code>no argument</code>: show global information | |
| − | + | ||
| − | + | * <code>DB</code>: shows database information | |
| − | + | ||
| − | + | * <code>INDEX</code>: shows index information | |
| − | + | ||
| − | + | * <code>TABLE [start end] | [query]</code>: show internal database table | |
| + | |||
| + | |||
===Close=== | ===Close=== | ||
| − | + | ||
| − | <code>CLOSE </code> | + | ;<code>CLOSE </code> |
| − | Closes the current database. | + | :Closes the current database. |
| − | + | ||
===List=== | ===List=== | ||
| − | + | ||
| − | <code>LIST </code> | + | ;<code>LIST </code> |
| − | Lists all available databases. | + | :Lists all available databases. |
| − | + | ||
===Drop=== | ===Drop=== | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | < | + | ;<code>DROP [DB|INDEX|USER] [...]</code> |
| − | < | + | :Drops a database, index or user: |
| − | + | ||
| − | + | ;<code>DB [name]</code>: | |
| − | + | : drops the database | |
| − | + | ||
| − | + | ;<code>INDEX [PATH|TEXT|ATTRIBUTE|FULLTEXT]</code>: | |
| − | + | :drops the specified index | |
| − | + | ||
| − | + | ;<code>USER [name]</code>: | |
| − | + | :drops the specified user | |
| + | |||
| + | |||
===Export=== | ===Export=== | ||
| − | + | ||
| − | <code>EXPORT [path]</code | + | ;<code>EXPORT [path]</code> |
| − | Exports the database to [path]. | + | :Exports the database to [path]. |
| − | + | ||
===Optimize=== | ===Optimize=== | ||
| − | + | ||
| − | <code>OPTIMIZE </code | + | ;<code>OPTIMIZE </code> |
| − | Optimizes the current database structures. | + | :Optimizes the current database structures. |
| − | + | ||
==Query Commands== | ==Query Commands== | ||
===Xquery=== | ===Xquery=== | ||
| − | + | ||
| − | <code>XQUERY [query]</code> | + | ;<code>XQUERY [query]</code> |
| − | Evaluates the specified query and prints the result. | + | :Evaluates the specified query and prints the result. |
| − | + | ||
===Find=== | ===Find=== | ||
| − | + | ||
| − | <code>FIND [query]</code> | + | ;<code>FIND [query]</code> |
| − | The following modifiers can be used: | + | :The following modifiers can be used: |
| − | + | ||
===Run=== | ===Run=== | ||
| − | + | ||
| − | <code>RUN [path]</code> | + | ;<code>RUN [path]</code> |
| − | Evaluates an query from [path] and prints the result. | + | :Evaluates an query from [path] and prints the result. |
| − | + | ||
===CS=== | ===CS=== | ||
| − | + | ||
| − | <code>CS [query]</code> | + | ;<code>CS [query]</code> |
| − | Evaluates the query and sets the result as new context set. | + | :Evaluates the query and sets the result as new context set. |
| − | + | ||
==Admin Commands== | ==Admin Commands== | ||
===Show=== | ===Show=== | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | < | + | ;<code>SHOW [DATABASES|SESSIONS|USERS|BACKUPS]</code> |
| − | < | + | :Shows server information: |
| − | + | * <code>DATABASES</code>: shows currently opened databases. | |
| − | + | * <code>SESSIONS</code>: shows current database sessions. | |
| − | + | * <code>USERS (ON [db])</code>: shows users (on a database). | |
| − | + | * <code>BACKUPS</code>: shows backups. | |
| − | + | ||
| − | + | ||
| − | |||
| − | |||
===Grant=== | ===Grant=== | ||
| − | + | ||
| − | <code>GRANT [NONE|READ|WRITE|CREATE|ADMIN] (ON [db]) TO [user]</code> | + | ;<code>GRANT [NONE|READ|WRITE|CREATE|ADMIN] (ON [db]) TO [user]</code> |
| − | Grants permissions (on a database) to a user. | + | :Grants permissions (on a database) to a user. |
| − | + | ||
===Alter=== | ===Alter=== | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | < | + | ;<code>ALTER [USER|DB] [...]</code> |
| − | < | + | :Alters user password or database name: |
| − | + | ||
| − | + | ; <code>USER [name] ([password])</code>: | |
| − | + | : alters the password of a user. | |
| − | + | ||
| − | + | ; <code>DB [name] [newname]</code>: | |
| − | + | : alters the name of a database. | |
| + | |||
| + | |||
===Kill=== | ===Kill=== | ||
| − | + | ||
| − | <code>KILL [name]</code> | + | ;<code>KILL [name]</code> |
| − | Kills all sessions of the specified user. | + | :Kills all sessions of the specified user. |
| − | + | ||
===Backup=== | ===Backup=== | ||
| − | + | ||
| − | <code>BACKUP [name]</code> | + | ;<code>BACKUP [name]</code> |
| − | Creates a backup of the specified database. | + | :Creates a backup of the specified database. |
| − | + | ||
===Restore=== | ===Restore=== | ||
| − | + | ||
| − | <code>RESTORE [name]</code> | + | ;<code>RESTORE [name]</code> |
| − | Restores a backup of the specified database. | + | :Restores a backup of the specified database. |
| − | + | ||
==General Commands== | ==General Commands== | ||
===Set=== | ===Set=== | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | < | + | ;<code>SET [option] ([value])</code> |
| − | < | + | :Available options [option] with value [value] = on/off: |
| − | + | * <code>QUERYINFO</code>: Display of query info | |
| − | + | * <code>DEBUG</code>: Display of debug info | |
| − | + | * <code>SERIALIZE</code>: Serialization of query results | |
| − | + | * <code>CHOP</code>: Chopping of XML whitespaces | |
| − | + | * <code>ENTITY</code>: Parsing of XML entities | |
| − | + | * <code>TEXTINDEX</code>: Text indexing | |
| − | + | * <code>ATTRINDEX</code>: Attribute value indexing | |
| − | + | * <code>FTINDEX</code>: Full-text indexing | |
| − | + | * <code>PATHINDEX</code>: Path indexing | |
| − | + | * <code>WRITEBACK</code>: Propagating changes to input file | |
| − | + | ||
| − | + | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Have a look into [[Settings]] to find | Have a look into [[Settings]] to find | ||
| − | a complete list of available options. | + | a complete list of available options. |
| + | |||
===Password=== | ===Password=== | ||
| − | + | ||
| − | <code>PASSWORD ([password])</code | + | ;<code>PASSWORD ([password])</code> |
| − | Changes the user's password. | + | :Changes the user's password. |
| − | + | ||
===Help=== | ===Help=== | ||
| − | + | ||
| − | <code>HELP ([command])</code | + | ;<code>HELP ([command])</code> |
| − | If [command] is specified, information on the specific | + | :If [command] is specified, information on the specific command is printed; otherwise, all commands are listed. |
| − | command is printed; otherwise, all commands are listed. | + | |
| − | |||
===Exit=== | ===Exit=== | ||
| − | + | ||
| − | <code>EXIT </code> | + | ;<code>EXIT </code> |
| − | Exits BaseX. | + | :Exits BaseX. |
| − | |||
Revision as of 12:45, 7 December 2010
Here you find a description of all database commands which you can enter in the console mode, in the Command text field in the GUI, or send to the BaseX server:
Database Commands
Create
CREATE [DB|FS|INDEX|USER] [...]- Creates a new database, index or user:
DB [name] ([input])- creates the database
[name]with an optional[input]
INDEX [TEXT|ATTRIBUTE|FULLTEXT|PATH]- creates the specified index
FS [name] [path] ([mountpoint] [backingstore])- creates filesystem database
[name]for[path](using[mountpoint]and[backingstore]if FUSE is activated)
USER [name] ([password])- creates the specified user
Open
OPEN [name]- Opens the specified database [name].
Add
ADD (AS [name]) (TO [target]) [input]- Adds [input] as [name] to the database, using an optional [target] path.
Delete
DELETE [name]- Deletes a document from the current database.
Info
INFO ([DB|INDEX|TABLE])- Shows information on the currently opened database
no argument: show global information
DB: shows database information
INDEX: shows index information
TABLE [start end] | [query]: show internal database table
Close
CLOSE- Closes the current database.
List
LIST- Lists all available databases.
Drop
DROP [DB|INDEX|USER] [...]- Drops a database, index or user:
DB [name]- drops the database
INDEX [PATH|TEXT|ATTRIBUTE|FULLTEXT]- drops the specified index
USER [name]- drops the specified user
Export
EXPORT [path]- Exports the database to [path].
Optimize
OPTIMIZE- Optimizes the current database structures.
Query Commands
Xquery
XQUERY [query]- Evaluates the specified query and prints the result.
Find
FIND [query]- The following modifiers can be used:
Run
RUN [path]- Evaluates an query from [path] and prints the result.
CS
CS [query]- Evaluates the query and sets the result as new context set.
Admin Commands
Show
SHOW [DATABASES|SESSIONS|USERS|BACKUPS]- Shows server information:
DATABASES: shows currently opened databases.SESSIONS: shows current database sessions.USERS (ON [db]): shows users (on a database).BACKUPS: shows backups.
Grant
GRANT [NONE|READ|WRITE|CREATE|ADMIN] (ON [db]) TO [user]- Grants permissions (on a database) to a user.
Alter
ALTER [USER|DB] [...]- Alters user password or database name:
USER [name] ([password])- alters the password of a user.
DB [name] [newname]- alters the name of a database.
Kill
KILL [name]- Kills all sessions of the specified user.
Backup
BACKUP [name]- Creates a backup of the specified database.
Restore
RESTORE [name]- Restores a backup of the specified database.
General Commands
Set
SET [option] ([value])- Available options [option] with value [value] = on/off:
QUERYINFO: Display of query infoDEBUG: Display of debug infoSERIALIZE: Serialization of query resultsCHOP: Chopping of XML whitespacesENTITY: Parsing of XML entitiesTEXTINDEX: Text indexingATTRINDEX: Attribute value indexingFTINDEX: Full-text indexingPATHINDEX: Path indexingWRITEBACK: Propagating changes to input file
Have a look into Settings to find a complete list of available options.
Password
PASSWORD ([password])- Changes the user's password.
Help
HELP ([command])- If [command] is specified, information on the specific command is printed; otherwise, all commands are listed.
Exit
EXIT- Exits BaseX.