Jump to navigation Jump to search
667 bytes removed ,  11:45, 7 December 2010
Wikified the markup
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==
<code>CREATE [DB|FS|INDEX|USER] [...]</code><br/>
Creates a new database, index or user:
;<ulcode> CREATE [DB|FS|INDEX|USER] [...]<li/code> :Creates a new database, index or user: ;<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>
<p> ;<code>OPEN [name]</code><br/> :Opens the specified database [name].</p>
<p> ;<code>ADD (AS [name]) (TO [target]) [input]</code><br/> :Adds [input] as [name] to the database, using an optional[target] path.</p>
<p> ;<code>DELETE [name]</code><br/> :Deletes a document from the current database.</p>
<code>INFO ([DB|INDEX|TABLE])</code><br/>
Shows information on the currently opened database:
;<ulcode> INFO ([DB|INDEX|TABLE])<li/code> ;Shows information on the currently opened database: * <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>
<p> ;<code>CLOSE </code><br/> :Closes the current database.</p>
<p> ;<code>LIST </code><br/> :Lists all available databases.</p>
<code>DROP [DB|INDEX|USER] [...]</code><br/>
Drops a database, index or user:
;<ulcode> DROP [DB|INDEX|USER] [...]<li/code> :Drops a database, index or user: ;<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>
<p> ;<code>EXPORT [path]</code><br/> :Exports the database to [path].</p>
<p> ;<code>OPTIMIZE </code><br/> :Optimizes the current database structures.</p>
==Query Commands==
<p> ;<code>XQUERY [query]</code><br/> :Evaluates the specified query and prints the result.</p>
<p> ;<code>FIND [query]</code><br/> :The following modifiers can be used:</p>
<p> ;<code>RUN [path]</code><br/> :Evaluates an query from [path] and prints the result.</p>
<p> ;<code>CS [query]</code><br/> :Evaluates the query and sets the result as new context set.</p>
==Admin Commands==
Shows server information:
;<ulcode> SHOW [DATABASES|SESSIONS|USERS|BACKUPS]<li/code> :Shows server information:* <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>
<p> ;<code>GRANT [NONE|READ|WRITE|CREATE|ADMIN] (ON [db]) TO [user]</code><br/> :Grants permissions (on a database) to a user.</p>
<code>ALTER [USER|DB] [...]</code><br/>
Alters user password or database name:
;<ulcode> ALTER [USER|DB] [...]<li/code> :Alters user password or database name: ; <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>
<p> ;<code>KILL [name]</code><br/> :Kills all sessions of the specified user.</p>
<p> ;<code>BACKUP [name]</code><br/> :Creates a backup of the specified database.</p>
<p> ;<code>RESTORE [name]</code><br/> :Restores a backup of the specified database.</p>
==General Commands==
<code>SET [option] ([value])</code><br/>
Available options [option] with value [value] = on/off:
;<ulcode> SET [option] ([value])<li/code> :Available options [option] with value [value] = on/off: * <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> <li>* <code>WRITEBACK</code>: Propagating changes to input file<br/> </li> </ul>
Have a look into [[Settings]] to find
a complete list of available options.<br /> 
<p> ;<code>PASSWORD ([password])</code><br/> :Changes the user's password.</p>
<p> ;<code>HELP ([command])</code><br/> :If [command] is specified, information on the specificcommand is printed; otherwise, all commands are listed.</p>
<p> ;<code>EXIT </code><br/> :Exits BaseX.</p>
administrator, Bureaucrats, editor, Interface administrators, reviewer, Administrators


Navigation menu