Changes

Jump to navigation Jump to search
5,204 bytes added ,  14:48, 6 December 2010
Created page with "<p> 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:</p> ==Data..."
<p>
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:</p>

==Database Commands==
===Create===
<p>
<code>CREATE [DB|FS|INDEX|USER] [...]</code><br/>
Creates a new database, index or user:
</p>

<ul>
<li><code>DB [name] ([input])</code>: <br/>
creates the database <code>[name]</code> with an optional <code>[input]</code>
</li>
<li><code>INDEX [TEXT|ATTRIBUTE|FULLTEXT|PATH]</code>: <br/>
creates the specified index
</li>
<li><code>FS [name] [path] ([mountpoint] [backingstore])</code>: <br/>
creates filesystem database <code>[name]</code> for <code>[path]</code>
(using <code>[mountpoint]</code> and <code>[backingstore]</code> if FUSE is activated)
</li>
<li><code>USER [name] ([password])</code>: <br/>
creates the specified user
</li>
</ul>

===Open===
<p>
<code>OPEN [name]</code><br/>
Opens the specified database [name].
</p>


===Add===
<p>
<code>ADD (AS [name]) (TO [target]) [input]</code><br/>
Adds [input] as [name] to the database, using an optional
[target] path.
</p>


===Delete===
<p>
<code>DELETE [name]</code><br/>
Deletes a document from the current database.
</p>


===Info===
<p>
<code>INFO ([DB|INDEX|TABLE])</code><br/>
Shows information on the currently opened database:
</p>

<ul>
<li><code>no argument</code>: show global information<br/>
</li>
<li><code>DB</code>: shows database information<br/>
</li>
<li><code>INDEX</code>: shows index information<br/>
</li>
<li><code>TABLE [start end] | [query]</code>: show internal database table<br/>
</li>
</ul>

===Close===
<p>
<code>CLOSE </code><br/>
Closes the current database.
</p>


===List===
<p>
<code>LIST </code><br/>
Lists all available databases.
</p>


===Drop===
<p>
<code>DROP [DB|INDEX|USER] [...]</code><br/>
Drops a database, index or user:
</p>

<ul>
<li><code>DB [name]</code>: <br/>
drops the database
</li>
<li><code>INDEX [PATH|TEXT|ATTRIBUTE|FULLTEXT]</code>: <br/>
drops the specified index
</li>
<li><code>USER [name]</code>: <br/>
drops the specified user
</li>
</ul>

===Export===
<p>
<code>EXPORT [path]</code><br/>
Exports the database to [path].
</p>


===Optimize===
<p>
<code>OPTIMIZE </code><br/>
Optimizes the current database structures.
</p>


<br/>
==Query Commands==
===Xquery===
<p>
<code>XQUERY [query]</code><br/>
Evaluates the specified query and prints the result.
</p>


===Find===
<p>
<code>FIND [query]</code><br/>
The following modifiers can be used:
</p>


===Run===
<p>
<code>RUN [path]</code><br/>
Evaluates an query from [path] and prints the result.
</p>


===CS===
<p>
<code>CS [query]</code><br/>
Evaluates the query and sets the result as new context set.
</p>


<br/>
==Admin Commands==
===Show===
<p>
<code>SHOW [DATABASES|SESSIONS|USERS|BACKUPS]</code><br/>
Shows server information:
</p>

<ul>
<li><code>DATABASES</code>: shows currently opened databases.<br/>
</li>
<li><code>SESSIONS</code>: shows current database sessions.<br/>
</li>
<li><code>USERS (ON [db])</code>: shows users (on a database).<br/>
</li>
<li><code>BACKUPS</code>: shows backups.<br/>
</li>
</ul>

===Grant===
<p>
<code>GRANT [NONE|READ|WRITE|CREATE|ADMIN] (ON [db]) TO [user]</code><br/>
Grants permissions (on a database) to a user.
</p>


===Alter===
<p>
<code>ALTER [USER|DB] [...]</code><br/>
Alters user password or database name:
</p>

<ul>
<li><code>USER [name] ([password])</code>: <br/>
alters the password of a user.
</li>
<li><code>DB [name] [newname]</code>: <br/>
alters the name of a database.
</li>
</ul>

===Kill===
<p>
<code>KILL [name]</code><br/>
Kills all sessions of the specified user.
</p>


===Backup===
<p>
<code>BACKUP [name]</code><br/>
Creates a backup of the specified database.
</p>


===Restore===
<p>
<code>RESTORE [name]</code><br/>
Restores a backup of the specified database.
</p>


<br/>
==General Commands==
===Set===
<p>
<code>SET [option] ([value])</code><br/>
Available options [option] with value [value] = on/off:
</p>

<ul>
<li><code>QUERYINFO</code>: Display of query info<br/>
</li>
<li><code>DEBUG</code>: Display of debug info<br/>
</li>
<li><code>SERIALIZE</code>: Serialization of query results<br/>
</li>
<li><code>CHOP</code>: Chopping of XML whitespaces<br/>
</li>
<li><code>ENTITY</code>: Parsing of XML entities<br/>
</li>
<li><code>TEXTINDEX</code>: Text indexing<br/>
</li>
<li><code>ATTRINDEX</code>: Attribute value indexing<br/>
</li>
<li><code>FTINDEX</code>: Full-text indexing<br/>
</li>
<li><code>PATHINDEX</code>: Path indexing<br/>
</li>
</ul>

Have a look into the <a href='faq#5.4'>FAQ</a> to find
a complete list of available options.<br />

===Password===
<p>
<code>PASSWORD ([password])</code><br/>
Changes the user's password.
</p>


===Help===
<p>
<code>HELP ([command])</code><br/>
If [command] is specified, information on the specific
command is printed; otherwise, all commands are listed.
</p>


===Exit===
<p>
<code>EXIT </code><br/>
Exits BaseX.
</p>
bueraucrat, Bureaucrats, editor, reviewer, Administrators
907

edits

Navigation menu