Changes

Jump to navigation Jump to search
1,575 bytes added ,  01:09, 6 May 2011
no edit summary
This page lists all commands that are supported by BaseX.
Commands can be either run from [[Startup_Options#BaseX_Standalone|command line]] or from the input field in the [[GUI_Tutorial|GUI]] frontend. If commands Commands, which are triggered by the GUI itself, they will be listed show up in the [[GUI_Views|Info View]].
A short version exists for some command arguments. For example, you may replace the <code>DATABASE</code> keyword with <code>DB</code>.
 
<hr/>
<div style="float:left; width:48%;">
 
===ADD===
<code>[target]</code> path and an optional file <code>[name]</code>.
The input may either be a single XML document, a directory, a remote URL or a plain XML string.
The optional name is ignored if the input is a directory.
<hr/>
===ALTER===
Alters the password of a user, or the name of a database:
* <code>USER [name] ([password])</code>:
: alters Alters the <code>[password] </code> of the user specified with <code>[name]</code>. If no password is specified in the console mode, it is requested via standard input.
* <code>DATABASE [name] [newname]</code>
: alters Alters the <code>[name] </code> of a database to <code>[newname]</code>.<hr/>
===BACKUP===
'''<code>BACKUP [name]</code>'''
Creates a zipped backup of the specified database. The backup file will be suffixed with the current timestamp.<hr/>
===CHECK===
'''<code>CHECK [input]</code>'''
Opens an existing database for the specified <code>[input]</code> or creates a new instance.<hr/>
===CLOSE===
Closes the currently opened database.
<hr/>
===COPY===
'''<code>COPY [name] [newname]</code>'''
Creates an identical copy of the specified database copy.<hr/>
===CREATE===
Creates a new database, index or user:
* <code>DATABASE [name] ([input])</code>:
: creates Creates the database <code>[name]</code> with an optional <code>[input]</code>.: The input may either be a single XML document, a directory, a remote URL or a plain XML string.
* <code>INDEX [TEXT|ATTRIBUTE|FULLTEXT|PATH]</code>:
: creates Creates the specified index
* <code>USER [name] ([password])</code>:
: creates Creates a user with the specified user[name] and [password]. If no password is specified in the console mode, it is requested via standard input.<hr/>
===CS===
'''<code>CS [query]</code>'''
Evaluates the specified <code>[query ]</code> and sets the result as new context set.<hr/>
===DELETE===
'''<code>DELETE [namepath]</code>''' Deletes documents from the currently opened database.
Deletes all documents from the currently opened database that start with the specified <code>[path]</code>.
<hr/>
===DROP===
'''<code>DROP [DBDATABASE|INDEX|USER] [...]</code>'''
Drops a database, index or user:
* <code>DB DATABASE [name]</code>:: drops Drops the databasewith the specified <code>[name]</code>.
* <code>INDEX [PATH|TEXT|ATTRIBUTE|FULLTEXT]</code>:
: drops Drops the specified index.* <code>USER [name] (ON [dbdatabase])</code>:: drops Drops the user with the specified user (on <code>[name]</code>. If a <code>[database)]</code> is specified, the user is only dropped locally.
* <code>BACKUP [name]</code>:
: drops Drops all backups for the database backupwith the specified <code>[name]</code>.<hr/>
===EXIT===
'''<code>EXIT </code>'''
Exits the BaseX consolemode.<hr/>
===EXPORT===
'''<code>EXPORT [path]</code>'''
Exports all documents in the database to the specified <code>[path]</code>.
</div><div style="float:left; width:4%;">&nbsp;
</div><div style="float:left; width:48%;">
===FIND===
'''<code>FIND [querykeywords]</code>'''
Builds and runs a query for the specified <code>[keywords]</code>. The following modifiers can be usedto further limit search::= : looks for exact text nodes"
:@= : looks for exact attributes
:@ : looks for attributes
 <hr/div><div style="float:left; width:4%;">&nbsp;</div><div style="float:left; width:48%;"> 
===GET===
'''<code>GET [option]</code>'''
Shows Returns the value of a global the specified <code>[option]</code>. A list of all options is [[Options|available here]].<hr/>
===GRANT===
'''<code>GRANT [NONE|READ|WRITE|CREATE|ADMIN] (ON [dbdatabase]) TO [user]</code>''' Grants permissions (on a database) to a user.
Grants the specified [[User_Management#Permissions|permission]] to the specified <code>[user]</code>. If a <code>[database]</code> is specified, the permissions are only granted locally.
<hr/>
===HELP===
If <code>[command]</code> is specified, information on the specific
command is printed; otherwise, all commands are listed.
<hr/>
===INFO===
'''<code>INFO ([DBDATABASE|INDEX|STORAGE])</code>'''
Shows information on the currently opened database:
* <code>no argument</code>: show Shows global informationon the DBMS* <code>DBDATABASE</code>: shows Shows general database information* <code>INDEX</code>: shows Shows information on the existing index informationstructures* <code>STORAGE [start end] | [query]</code>: show Shows the main table of the internal database tablestorage<hr/>
===KILL===
'''<code>KILL [name]</code>'''
Kills all sessions of the user specified userby <code>[name]</code>.<hr/>
===LIST===
'''<code>LIST ([path])</code>'''
Lists all available databases, or the documentswithin in a database .<code>[path]</code> is the name of the database, optionallyfollowed by a path to the requested documents.<hr/>
===OPEN===
'''<code>OPEN [namepath]</code>''' Opens the specified database <code>[name]</code>.
Opens the documents in a database.
<code>[path]</code> is the name of the database, optionally
followed by a path to the requested documents.
<hr/>
===OPTIMIZE===
'''<code>OPTIMIZE (ALL)</code>'''
Optimizes the current database structures. If the <code>ALL</code> flag is specified, the size of all database files is minimized.<hr/>
===PASSWORD===
'''<code>PASSWORD ([password])</code>'''
Changes the <code>[password]</code> of the current user's . If no passwordisspecified in the console mode, it is requested via standard input.<hr/>
===RESTORE===
'''<code>RESTORE [name]</code>'''
Restores a backup database with the specified [name]. The name may include the timestamp of the specified databasebackup file.<hr/>
===RUN===
'''<code>RUN [path]</code>'''
Evaluates an Runs the query from file specified by <code>[path]</code> and prints the result.<hr/>
===SET===
'''<code>SET [option] ([value])</code>'''
Available options Sets an <code>[option]</code> with value to the specified <code>[value]</code> = on/off:* <code>QUERYINFO</code>: Display query info* <code>DEBUG</code>: Display debug info* <code>SERIALIZE</code>: Serialize query results* <code>CHOP</code>: Chopp XML whitespaces* <code>ENTITY</code>: Parse XML entities* <code>TEXTINDEX</code>: Turn on/off text indexing* <code>ATTRINDEX</code>: Turn on/off attribute value indexing* <code>FTINDEX</code>: Turn on/off full-text indexing* <code>PATHINDEX</code>: Turn on/off path indexing.
A list of all options is [[Options|available here]].
<hr/>
===SHOW===
Shows server information:
* <code>DATABASES</code>: shows Shows the currently opened databases.* <code>SESSIONS</code>: shows current Shows the currently active database sessions.* <code>USERS (ON [dbdatabase])</code>: shows Shows all known users (on . If a <code>[database)]</code> is specified, local users are shown.* <code>BACKUPS</code>: shows Shows all database backups.<hr/>
===XQUERY===
'''<code>XQUERY [query]</code>'''
Evaluates Runs the specified <code>[query ]</code> and prints the result.
</div>
<hr/>
[[Category:Beginner]]
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu