Difference between revisions of "Commands"
(→XQUERY) |
|||
Line 3: | Line 3: | ||
text field in the GUI, or send to the BaseX server: | text field in the GUI, or send to the BaseX server: | ||
− | ==ADD== | + | Try "help [...]" to get info on a specific command. |
+ | |||
+ | ===ADD=== | ||
'''<code>ADD (AS [name]) (TO [target]) [input]</code>''' | '''<code>ADD (AS [name]) (TO [target]) [input]</code>''' | ||
Line 10: | Line 12: | ||
'''<code>[target]</code>''' path. | '''<code>[target]</code>''' path. | ||
− | ==ALTER== | + | ===ALTER=== |
'''<code>ALTER [USER|DATABASE] [...]</code>''' | '''<code>ALTER [USER|DATABASE] [...]</code>''' | ||
Alters user password or database name: | Alters user password or database name: | ||
− | |||
* '''<code>USER [name] ([password])</code>''': | * '''<code>USER [name] ([password])</code>''': | ||
: alters the password of a user. | : alters the password of a user. | ||
− | |||
* '''<code>DATABASE [name] [newname]</code>''' | * '''<code>DATABASE [name] [newname]</code>''' | ||
: alters the name of a database. | : alters the name of a database. | ||
− | ==BACKUP== | + | ===BACKUP=== |
'''<code>BACKUP [name]</code>''' | '''<code>BACKUP [name]</code>''' | ||
Line 28: | Line 28: | ||
Creates a backup of the specified database. | Creates a backup of the specified database. | ||
− | ==CLOSE== | + | ===CLOSE=== |
'''<code>CLOSE </code>''' | '''<code>CLOSE </code>''' | ||
Line 34: | Line 34: | ||
Closes the currently opened database. | Closes the currently opened database. | ||
− | ==CREATE== | + | ===CREATE=== |
'''<code>CREATE [DATABASE|FS|INDEX|USER] [...]</code>''' | '''<code>CREATE [DATABASE|FS|INDEX|USER] [...]</code>''' | ||
Creates a new database, index or user: | Creates a new database, index or user: | ||
− | |||
* '''<code>DATABASE [name] ([input])</code>''': | * '''<code>DATABASE [name] ([input])</code>''': | ||
: creates the database '''<code>[name]</code>''' with an optional '''<code>[input]</code>''' | : creates the database '''<code>[name]</code>''' with an optional '''<code>[input]</code>''' | ||
− | |||
* '''<code>INDEX [TEXT|ATTRIBUTE|FULLTEXT|PATH]</code>''': | * '''<code>INDEX [TEXT|ATTRIBUTE|FULLTEXT|PATH]</code>''': | ||
: creates the specified index | : creates the specified index | ||
− | |||
* '''<code>FS [name] [path] ([mountpoint] [backingstore])</code>''': | * '''<code>FS [name] [path] ([mountpoint] [backingstore])</code>''': | ||
: creates filesystem database '''<code>[name]</code>''' for '''<code>[path]</code>''' | : creates filesystem database '''<code>[name]</code>''' for '''<code>[path]</code>''' | ||
: (using '''<code>[mountpoint]</code>''' and '''<code>[backingstore]</code>''' if FUSE is activated) | : (using '''<code>[mountpoint]</code>''' and '''<code>[backingstore]</code>''' if FUSE is activated) | ||
− | |||
* '''<code>USER [name] ([password])</code>''': | * '''<code>USER [name] ([password])</code>''': | ||
: creates the specified user | : creates the specified user | ||
− | ==CS== | + | ===CS=== |
'''<code>CS [query]</code>''' | '''<code>CS [query]</code>''' | ||
Line 59: | Line 55: | ||
Evaluates the query and sets the result as new context set. | Evaluates the query and sets the result as new context set. | ||
− | ==DELETE== | + | ===DELETE=== |
'''<code>DELETE [name]</code>''' | '''<code>DELETE [name]</code>''' | ||
Line 65: | Line 61: | ||
Deletes documents from the currently opened database. | Deletes documents from the currently opened database. | ||
− | ==DROP== | + | ===DROP=== |
'''<code>DROP [DATABASE|INDEX|USER] [...]</code>''' | '''<code>DROP [DATABASE|INDEX|USER] [...]</code>''' | ||
Drops a database, index or user: | Drops a database, index or user: | ||
− | |||
* '''<code>DATABASE [name]</code>''': | * '''<code>DATABASE [name]</code>''': | ||
: drops the database | : drops the database | ||
− | |||
* '''<code>INDEX [PATH|TEXT|ATTRIBUTE|FULLTEXT]</code>''': | * '''<code>INDEX [PATH|TEXT|ATTRIBUTE|FULLTEXT]</code>''': | ||
: drops the specified index | : drops the specified index | ||
− | |||
* '''<code>USER [name]</code>''': | * '''<code>USER [name]</code>''': | ||
: drops the specified user | : drops the specified user | ||
− | |||
* '''<code>BACKUP [name]</code>''': | * '''<code>BACKUP [name]</code>''': | ||
: drops the database backup | : drops the database backup | ||
− | ==EXIT== | + | ===EXIT=== |
'''<code>EXIT </code>''' | '''<code>EXIT </code>''' | ||
Line 89: | Line 81: | ||
Exits BaseX. | Exits BaseX. | ||
− | ==EXPORT== | + | ===EXPORT=== |
'''<code>EXPORT [path]</code>''' | '''<code>EXPORT [path]</code>''' | ||
Line 95: | Line 87: | ||
Exports the database to '''<code>[path]</code>'''. | Exports the database to '''<code>[path]</code>'''. | ||
− | ==FIND== | + | ===FIND=== |
'''<code>FIND [query]</code>''' | '''<code>FIND [query]</code>''' | ||
Line 104: | Line 96: | ||
:@ : looks for attributes | :@ : looks for attributes | ||
− | ==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>''' | ||
Line 110: | Line 102: | ||
Grants permissions (on a database) to a user. | Grants permissions (on a database) to a user. | ||
− | ==HELP== | + | ===HELP=== |
'''<code>HELP ([command])</code>''' | '''<code>HELP ([command])</code>''' | ||
Line 117: | Line 109: | ||
command is printed; otherwise, all commands are listed. | command is printed; otherwise, all commands are listed. | ||
− | ==INFO== | + | ===INFO=== |
'''<code>INFO ([DATABASE|INDEX|STORAGE])</code>''' | '''<code>INFO ([DATABASE|INDEX|STORAGE])</code>''' | ||
Shows information on the currently opened database: | Shows information on the currently opened database: | ||
− | |||
* '''<code>no argument</code>''': show global information | * '''<code>no argument</code>''': show global information | ||
− | |||
* '''<code>DATABASE</code>''': shows database information | * '''<code>DATABASE</code>''': shows database information | ||
− | |||
* '''<code>INDEX</code>''': shows index information | * '''<code>INDEX</code>''': shows index information | ||
− | |||
* '''<code>STORAGE [start end] | [query]</code>''': show internal database table | * '''<code>STORAGE [start end] | [query]</code>''': show internal database table | ||
− | ==KILL== | + | ===KILL=== |
'''<code>KILL [name]</code>''' | '''<code>KILL [name]</code>''' | ||
Line 137: | Line 125: | ||
Kills all sessions of the specified user. | Kills all sessions of the specified user. | ||
− | ==LIST== | + | ===LIST=== |
'''<code>LIST </code>''' | '''<code>LIST </code>''' | ||
Line 143: | Line 131: | ||
Lists all available databases. | Lists all available databases. | ||
− | ==OPEN== | + | ===OPEN=== |
'''<code>OPEN [name]</code>''' | '''<code>OPEN [name]</code>''' | ||
Line 149: | Line 137: | ||
Opens the specified database '''<code>[name]</code>'''. | Opens the specified database '''<code>[name]</code>'''. | ||
− | ==OPTIMIZE== | + | ===OPTIMIZE=== |
'''<code>OPTIMIZE </code>''' | '''<code>OPTIMIZE </code>''' | ||
Line 155: | Line 143: | ||
Optimizes the current database structures. | Optimizes the current database structures. | ||
− | ==PASSWORD== | + | ===PASSWORD=== |
'''<code>PASSWORD ([password])</code>''' | '''<code>PASSWORD ([password])</code>''' | ||
Line 161: | Line 149: | ||
Changes the user's password. | Changes the user's password. | ||
− | ==RESTORE== | + | ===RESTORE=== |
'''<code>RESTORE [name]</code>''' | '''<code>RESTORE [name]</code>''' | ||
Line 167: | Line 155: | ||
Restores a backup of the specified database. | Restores a backup of the specified database. | ||
− | ==RUN== | + | ===RUN=== |
'''<code>RUN [path]</code>''' | '''<code>RUN [path]</code>''' | ||
Line 173: | Line 161: | ||
Evaluates an query from '''<code>[path]</code>''' and prints the result. | Evaluates an query from '''<code>[path]</code>''' and prints the result. | ||
− | ==SET== | + | ===SET=== |
'''<code>SET [option] ([value])</code>''' | '''<code>SET [option] ([value])</code>''' | ||
Available options '''<code>[option]</code>''' with value '''<code>[value]</code>''' = on/off: | Available options '''<code>[option]</code>''' with value '''<code>[value]</code>''' = on/off: | ||
− | |||
* '''<code>QUERYINFO</code>''': Display of query info | * '''<code>QUERYINFO</code>''': Display of query info | ||
− | |||
* '''<code>DEBUG</code>''': Display of debug info | * '''<code>DEBUG</code>''': Display of debug info | ||
− | |||
* '''<code>SERIALIZE</code>''': Serialization of query results | * '''<code>SERIALIZE</code>''': Serialization of query results | ||
− | |||
* '''<code>CHOP</code>''': Chopping of XML whitespaces | * '''<code>CHOP</code>''': Chopping of XML whitespaces | ||
− | |||
* '''<code>ENTITY</code>''': Parsing of XML entities | * '''<code>ENTITY</code>''': Parsing of XML entities | ||
− | |||
* '''<code>TEXTINDEX</code>''': Text indexing | * '''<code>TEXTINDEX</code>''': Text indexing | ||
− | |||
* '''<code>ATTRINDEX</code>''': Attribute value indexing | * '''<code>ATTRINDEX</code>''': Attribute value indexing | ||
− | |||
* '''<code>FTINDEX</code>''': Full-text indexing | * '''<code>FTINDEX</code>''': Full-text indexing | ||
− | |||
* '''<code>PATHINDEX</code>''': Path indexing | * '''<code>PATHINDEX</code>''': Path indexing | ||
Have a look into [[Settings]] to find a complete list of available options. | Have a look into [[Settings]] to find a complete list of available options. | ||
− | ==SHOW== | + | ===SHOW=== |
'''<code>SHOW [DATABASES|SESSIONS|USERS|BACKUPS]</code>''' | '''<code>SHOW [DATABASES|SESSIONS|USERS|BACKUPS]</code>''' | ||
Shows server information: | Shows server information: | ||
− | |||
* '''<code>DATABASES</code>''': shows currently opened databases. | * '''<code>DATABASES</code>''': shows currently opened databases. | ||
− | |||
* '''<code>SESSIONS</code>''': shows current database sessions. | * '''<code>SESSIONS</code>''': shows current database sessions. | ||
− | |||
* '''<code>USERS (ON [db])</code>''': shows users (on a database). | * '''<code>USERS (ON [db])</code>''': shows users (on a database). | ||
− | |||
* '''<code>BACKUPS</code>''': shows backups. | * '''<code>BACKUPS</code>''': shows backups. | ||
− | ==XQUERY== | + | ===XQUERY=== |
'''<code>XQUERY [query]</code>''' | '''<code>XQUERY [query]</code>''' |
Revision as of 02:24, 16 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:
Try "help [...]" to get info on a specific command.
Contents
ADD
ADD (AS [name]) (TO [target]) [input]
Adds [input]
as [name]
to the database, using an optional
[target]
path.
ALTER
ALTER [USER|DATABASE] [...]
Alters user password or database name:
USER [name] ([password])
:
- alters the password of a user.
DATABASE [name] [newname]
- alters the name of a database.
BACKUP
BACKUP [name]
Creates a backup of the specified database.
CLOSE
CLOSE
Closes the currently opened database.
CREATE
CREATE [DATABASE|FS|INDEX|USER] [...]
Creates a new database, index or user:
DATABASE [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
CS
CS [query]
Evaluates the query and sets the result as new context set.
DELETE
DELETE [name]
Deletes documents from the currently opened database.
DROP
DROP [DATABASE|INDEX|USER] [...]
Drops a database, index or user:
DATABASE [name]
:
- drops the database
INDEX [PATH|TEXT|ATTRIBUTE|FULLTEXT]
:
- drops the specified index
USER [name]
:
- drops the specified user
BACKUP [name]
:
- drops the database backup
EXIT
EXIT
Exits BaseX.
EXPORT
EXPORT [path]
Exports the database to [path]
.
FIND
FIND [query]
The following modifiers can be used:
- = : looks for exact text nodes"
- @= : looks for exact attributes
- @ : looks for attributes
GRANT
GRANT [NONE|READ|WRITE|CREATE|ADMIN] (ON [db]) TO [user]
Grants permissions (on a database) to a user.
HELP
HELP ([command])
If [command]
is specified, information on the specific
command is printed; otherwise, all commands are listed.
INFO
INFO ([DATABASE|INDEX|STORAGE])
Shows information on the currently opened database:
no argument
: show global informationDATABASE
: shows database informationINDEX
: shows index informationSTORAGE [start end] | [query]
: show internal database table
KILL
KILL [name]
Kills all sessions of the specified user.
LIST
LIST
Lists all available databases.
OPEN
OPEN [name]
Opens the specified database [name]
.
OPTIMIZE
OPTIMIZE
Optimizes the current database structures.
PASSWORD
PASSWORD ([password])
Changes the user's password.
RESTORE
RESTORE [name]
Restores a backup of the specified database.
RUN
RUN [path]
Evaluates an query from [path]
and prints the result.
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 indexing
Have a look into Settings to find a complete list of available options.
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.
XQUERY
XQUERY [query]
Evaluates the specified query and prints the result.