Changes

Jump to navigation Jump to search
59 bytes removed ,  13:42, 26 July 2012
no edit summary
* In the client terminal, type in:
<pre>
: > [[Commands#CREATE DATABASE|CREATE DB]] factbook factbook.xml
</pre>
* For example, this query returns all country nodes in the currently opened database.
<pre>
: > [[Commands#XQUERY|XQUERY]] //country
</pre>
* You can also run queries in files:
<pre>
: > [[Commands#RUN|RUN]] /Users/John/query.xq
</pre>
* Create the new database, named 'xmark'.
<pre>
: > [[Commands#CREATE DATABASE|CREATE DB]] xmark xmark.xml
</pre>
* Set the new database xmark as the context:
<pre>
: > [[Commands#OPEN|OPEN]] xmark
</pre>
* Now you can easily execute queries on your new database:
<pre>
: > [[Commands#XQUERY|XQUERY]] //people/person/name
</pre>
* You can explicitly query the factbook database with the <code>doc(...)</code> funtion, no matter what the current context is.
<pre>
: > [[Commands#XQUERY|XQUERY]] doc("factbook")//country
</pre>
* Otherwise, to set factbook as the current context, execute the following:
<pre>
: > [[Commands#OPEN|OPEN]] factbook
</pre>
* To list the current context, type:
<pre>
: > [[Commands#SHOW|SHOW]] DATABASES
</pre>
* To [[Commands|close]] the current context database, please type:
<pre>
: > [[Commands#CLOSE|CLOSE]]
</pre>
* Use the [[Commands#DROP|DROP]] command to delete the xmark database:
<pre>
: > [[Commands#DROP DATABASE|DROP DB]] xmark
</pre>
* First make sure factbook is opened:
<pre>
: > [[Commands#OPEN|OPEN]] factbook
</pre>
* Now add the xmark.xml document:
<pre>
: > [[Commands#ADD|ADD]] xmark.xml
</pre>
* Deleting a document from a collection is easy:
<pre>
: > [[Commands#DELETE|DELETE]] xmark.xml
</pre>
* To delete the collection factbook, type:
<pre>
: > [[Commands#DROP DATABASE|DROP DB]] factbook
</pre>
* To see all databases on the server, type:
<pre>
: > [[Commands#LIST|LIST]]
</pre>
* To see which database is currently opened:
<pre>
: > [[Commands#SHOW DATABASES|SHOW DATABASES]]
</pre>
* To see the general information of the opened database, type:
<pre>
: > [[Commands#INFO|INFO]]
</pre>
* To see the users in BaseX, type:
<pre>
: > [[Commands#SHOW USERS|SHOW USERS]]
</pre>
==Backup and restore==
* To backup your database, type:
:<pre>
> [[Commands#CREATE BACKUP|CREATE BACKUP]] factbook
</pre>
* To restore your database, type:
:<pre>
> [[Commands#RESTORE|RESTORE]] factbook
</pre>
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu