Changes

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

edits

Navigation menu