Difference between revisions of "Commands"

From BaseX Documentation
Jump to navigation Jump to search
Line 2: Line 2:
 
which you can enter in the console mode, in the Command
 
which you can enter in the console mode, in the Command
 
text field in the GUI, or send to the BaseX server:
 
text field in the GUI, or send to the BaseX server:
 +
 +
==ADD==
 +
 +
'''<code>ADD (AS [name]) (TO [target]) [input]</code>'''
 +
 +
Adds '''<code>[input]</code>''' as '''<code>[name]</code>''' to the database, using an optional
 +
'''<code>[target]</code>''' path.
 +
 +
==ALTER==
 +
 +
'''<code>ALTER [USER|DATABASE] [...]</code>'''
 +
 +
Alters user password or database name:
 +
 +
* '''<code>USER [name] ([password])</code>''':
 +
: alters the password of a user.
 +
 +
* '''<code>DATABASE [name] [newname]</code>'''
 +
: alters the name of a database.
 +
 +
==BACKUP==
 +
 +
'''<code>BACKUP [name]</code>'''
 +
 +
Creates a backup of the specified database.
 +
 +
==CLOSE==
 +
 +
'''<code>CLOSE </code>'''
 +
 +
Closes the currently opened database.
  
 
==CREATE==
 
==CREATE==
Line 9: Line 40:
 
Creates a new database, index or user:
 
Creates a new database, index or user:
  
* '''<code>DATABASE [name] ([input]):</code>'''
+
* '''<code>DATABASE [name] ([input])</code>''':
 
: creates the database '''<code>[name]</code>''' with an optional '''<code>[input]</code>'''
 
: creates the database '''<code>[name]</code>''' with an optional '''<code>[input]</code>'''
  
* '''<code>INDEX [TEXT|ATTRIBUTE|FULLTEXT|PATH]: </code>'''
+
* '''<code>INDEX [TEXT|ATTRIBUTE|FULLTEXT|PATH]</code>''':
 
: creates the specified index
 
: creates the specified index
  
* '''<code>FS [name] [path] ([mountpoint] [backingstore]): </code>'''
+
* '''<code>FS [name] [path] ([mountpoint] [backingstore])</code>''':
 
: creates filesystem database '''<code>[name]</code>''' for '''<code>[path]</code>'''
 
: creates filesystem database '''<code>[name]</code>''' for '''<code>[path]</code>'''
 
: (using '''<code>[mountpoint]</code>''' and '''<code>[backingstore]</code>''' if FUSE is activated)
 
: (using '''<code>[mountpoint]</code>''' and '''<code>[backingstore]</code>''' if FUSE is activated)
  
* '''<code>USER [name] ([password]): </code>'''
+
* '''<code>USER [name] ([password])</code>''':
 
: creates the specified user
 
: creates the specified user
  
===Open===
+
==CS==
 
;<code>OPEN [name]</code> 
 
:Opens the specified database [name].
 
 
 
===Add===
 
 
;<code>ADD (AS [name]) (TO [target]) [input]</code> 
 
:Adds [input] as [name] to the database, using an optional [target] path.
 
 
 
===Delete===
 
 
;<code>DELETE [name]</code> 
 
:Deletes documents from the current database.
 
  
===Info===
+
'''<code>CS [query]</code>'''
 
;<code>INFO ([DB|INDEX|STORAGE])</code> 
 
;Shows information on the currently opened database:
 
 
* <code>no argument</code>:  show global information 
 
 
* <code>DB</code>:  shows database information 
 
 
* <code>INDEX</code>:  shows index information 
 
 
* <code>STORAGE [start end] | [query]</code>:  show internal database table
 
: '''what is start end?'''
 
  
===Close===
+
Evaluates the query and sets the result as new context set.
 
;<code>CLOSE </code> 
 
:Closes the current database.
 
 
 
===List===
 
 
;<code>LIST </code> 
 
:Lists all available databases.
 
 
 
===Drop===
 
 
;<code>DROP [DB|INDEX|USER] [...]</code> 
 
:Drops a database, index or user:
 
  
;<code>DB [name]</code>:
+
==DELETE==
 +
 
 +
'''<code>DELETE [name]</code>'''
 +
 
 +
Deletes documents from the currently opened database.
 +
 
 +
==DROP==
 +
 
 +
'''<code>DROP [DATABASE|INDEX|USER] [...]</code>'''
 +
 
 +
Drops a database, index or user:
 +
 
 +
* '''<code>DATABASE [name]</code>''':
 
: drops the database
 
: drops the database
 
;<code>INDEX [PATH|TEXT|ATTRIBUTE|FULLTEXT]</code>:
 
:drops the specified index
 
 
;<code>USER [name]</code>:
 
:drops the specified user
 
 
 
 
===Export===
 
 
;<code>EXPORT [path]</code>
 
:Exports the database to [path].
 
 
 
===Optimize===
 
 
;<code>OPTIMIZE </code>
 
:Optimizes the current database structures.
 
  
==[[Query Commands]]==
+
* '''<code>INDEX [PATH|TEXT|ATTRIBUTE|FULLTEXT]</code>''':
Moved to own section.
+
: drops the specified index
  
==Admin Commands==
+
* '''<code>USER [name]</code>''':
===Show===
+
: drops the specified user
+
 
;<code>SHOW [DATABASES|SESSIONS|USERS|BACKUPS]</code>
+
* '''<code>BACKUP [name]</code>''':
:Shows server information:
+
: drops the database backup
* <code>DATABASES</code>:  shows currently opened databases.  
+
 
* <code>SESSIONS</code>:  shows current database sessions. 
+
==EXIT==
* <code>USERS (ON [db])</code>:  shows users (on a database).
+
 
* <code>BACKUPS</code>:  shows backups. 
+
'''<code>EXIT </code>'''
+
 
   
+
Exits BaseX.
+
 
===Grant===  
+
==EXPORT==
+
 
;<code>GRANT [NONE|READ|WRITE|CREATE|ADMIN] (ON [db]) TO [user]</code>
+
'''<code>EXPORT [path]</code>'''
:Grants permissions (on a database) to a user.
+
 
+
Exports the database to '''<code>[path]</code>'''.
+
 
===Alter===  
+
==FIND==
+
 
;<code>ALTER [USER|DB] [...]</code>
+
'''<code>FIND [query]</code>'''
:Alters user password or database name:
+
 
+
The following modifiers can be used:
; <code>USER [name] ([password])</code>:  
+
:= : looks for exact text nodes"
: alters the password of a user.
+
:@= : looks for exact attributes
+
:@ : looks for attributes
; <code>DB [name] [newname]</code>:  
+
 
: alters the name of a database.
+
==GRANT==
+
 
+
'''<code>GRANT [NONE|READ|WRITE|CREATE|ADMIN] (ON [db]) TO [user]</code>'''
+
 
===Kill===  
+
Grants permissions (on a database) to a user.
+
 
;<code>KILL [name]</code>
+
==HELP==
:Kills all sessions of the specified user.
+
 
+
'''<code>HELP ([command])</code>'''
+
 
===Backup===  
+
If '''<code>[command]</code>''' is specified, information on the specific
+
command is printed; otherwise, all commands are listed.
;<code>BACKUP [name]</code>
+
 
:Creates a backup of the specified database.
+
==INFO==
+
 
+
'''<code>INFO ([DATABASE|INDEX|STORAGE])</code>'''
===Restore===  
+
 
+
Shows information on the currently opened database:
;<code>RESTORE [name]</code>
+
 
:Restores a backup of the specified database.
+
* '''<code>no argument</code>''': show global information
+
 
+
* '''<code>DATABASE</code>''': shows database information
 +
 
 +
* '''<code>INDEX</code>''': shows index information
 +
 
 +
* '''<code>STORAGE [start end] | [query]</code>''': show internal database table
 +
 
 +
==KILL==
 +
 
 +
'''<code>KILL [name]</code>'''
 +
 
 +
Kills all sessions of the specified user.
 +
 
 +
==LIST==
 +
 
 +
'''<code>LIST </code>'''
 +
 
 +
Lists all available databases.
 +
 
 +
==OPEN==
 +
 
 +
'''<code>OPEN [name]</code>'''
 +
 
 +
Opens the specified database '''<code>[name]</code>'''.
 +
 
 +
==OPTIMIZE==
 +
 
 +
'''<code>OPTIMIZE </code>'''
 +
 
 +
Optimizes the current database structures.
 +
 
 +
==PASSWORD==
 +
 
 +
'''<code>PASSWORD ([password])</code>'''
 +
 
 +
Changes the user's password.
 +
 
 +
==RESTORE==
 +
 
 +
'''<code>RESTORE [name]</code>'''
 +
 
 +
Restores a backup of the specified database.
 +
 
 +
==RUN==
 +
 
 +
'''<code>RUN [path]</code>'''
 +
 
 +
Evaluates an query from '''<code>[path]</code>''' and prints the result.
 +
 
 +
==SET==
 +
 
 +
'''<code>SET [option] ([value])</code>'''
 +
 
 +
Available options '''<code>[option]</code>''' with value '''<code>[value]</code>''' = on/off:
 +
 
 +
* '''<code>QUERYINFO</code>''': Display of query info
 +
 
 +
* '''<code>DEBUG</code>''': Display of debug info
 +
 
 +
* '''<code>SERIALIZE</code>''': Serialization of query results
 +
 
 +
* '''<code>CHOP</code>''': Chopping of XML whitespaces
 +
 
 +
* '''<code>ENTITY</code>''': Parsing of XML entities
 +
 
 +
* '''<code>TEXTINDEX</code>''': Text indexing
 +
 
 +
* '''<code>ATTRINDEX</code>''': Attribute value indexing
 +
 
 +
* '''<code>FTINDEX</code>''': Full-text indexing
 +
 
 +
* '''<code>PATHINDEX</code>''': Path indexing
 +
 
 +
==SHOW==
 +
 
 +
'''<code>SHOW [DATABASES|SESSIONS|USERS|BACKUPS]</code>'''
 +
 
 +
Shows server information:
 +
 
 +
* '''<code>DATABASES</code>''': shows currently opened databases.
 +
 
 +
* '''<code>SESSIONS</code>''': shows current database sessions.
  
==General Commands==
+
* '''<code>USERS (ON [db])</code>''': shows users (on a database).
===Set===
 
Have a look into [[Settings]] to find a complete list of available options.
 
 
;<code>SET [option] ([value])</code>
 
:Available options [option] with value [value] = on/off:
 
* <code>QUERYINFO</code>:  Display of query info 
 
* <code>DEBUG</code>:  Display of debug info 
 
* <code>SERIALIZE</code>:  Serialization of query results
 
* <code>CHOP</code>:  Chopping of XML whitespaces
 
* <code>ENTITY</code>:  Parsing of XML entities 
 
* <code>TEXTINDEX</code>:  Text indexing 
 
* <code>ATTRINDEX</code>:  Attribute value indexing 
 
* <code>FTINDEX</code>:  Full-text indexing 
 
* <code>PATHINDEX</code>:  Path indexing 
 
* <code>WRITEBACK</code>:  Propagating changes to input file
 
  
===Password===
+
* '''<code>BACKUPS</code>''': shows backups.
 
;<code>PASSWORD ([password])</code>
 
:Changes the user's password.
 
  
===Help===
+
==XQUERY==
 
;<code>HELP ([command])</code>
 
:If [command] is specified, information on the specific command is printed; otherwise, all commands are listed.
 
  
===Exit===
+
'''<code>XQUERY [query]</code>'''
 
;<code>EXIT </code>
 
:Exits BaseX.
 
  
[[Category:Commands]]
+
Evaluates the specified query and prints the result.

Revision as of 02:18, 16 December 2010

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:

ADD

ADD (AS [name]) (TO [target]) [input]

Adds [input] as [name] to the database, using an optional [target] path.

ALTER

ALTER [USER|DATABASE] [...]

Alters user password or database name:

  • USER [name] ([password]):
alters the password of a user.
  • DATABASE [name] [newname]
alters the name of a database.

BACKUP

BACKUP [name]

Creates a backup of the specified database.

CLOSE

CLOSE

Closes the currently opened database.

CREATE

CREATE [DATABASE|FS|INDEX|USER] [...]

Creates a new database, index or user:

  • DATABASE [name] ([input]):
creates the database [name] with an optional [input]
  • INDEX [TEXT|ATTRIBUTE|FULLTEXT|PATH]:
creates the specified index
  • FS [name] [path] ([mountpoint] [backingstore]):
creates filesystem database [name] for [path]
(using [mountpoint] and [backingstore] if FUSE is activated)
  • USER [name] ([password]):
creates the specified user

CS

CS [query]

Evaluates the query and sets the result as new context set.

DELETE

DELETE [name]

Deletes documents from the currently opened database.

DROP

DROP [DATABASE|INDEX|USER] [...]

Drops a database, index or user:

  • DATABASE [name]:
drops the database
  • INDEX [PATH|TEXT|ATTRIBUTE|FULLTEXT]:
drops the specified index
  • USER [name]:
drops the specified user
  • BACKUP [name]:
drops the database backup

EXIT

EXIT

Exits BaseX.

EXPORT

EXPORT [path]

Exports the database to [path].

FIND

FIND [query]

The following modifiers can be used:

= : looks for exact text nodes"
@= : looks for exact attributes
@ : looks for attributes

GRANT

GRANT [NONE|READ|WRITE|CREATE|ADMIN] (ON [db]) TO [user]

Grants permissions (on a database) to a user.

HELP

HELP ([command])

If [command] is specified, information on the specific command is printed; otherwise, all commands are listed.

INFO

INFO ([DATABASE|INDEX|STORAGE])

Shows information on the currently opened database:

  • no argument: show global information
  • DATABASE: shows database information
  • INDEX: shows index information
  • STORAGE [start end] | [query]: show internal database table

KILL

KILL [name]

Kills all sessions of the specified user.

LIST

LIST

Lists all available databases.

OPEN

OPEN [name]

Opens the specified database [name].

OPTIMIZE

OPTIMIZE

Optimizes the current database structures.

PASSWORD

PASSWORD ([password])

Changes the user's password.

RESTORE

RESTORE [name]

Restores a backup of the specified database.

RUN

RUN [path]

Evaluates an query from [path] and prints the result.

SET

SET [option] ([value])

Available options [option] with value [value] = on/off:

  • QUERYINFO: Display of query info
  • DEBUG: Display of debug info
  • SERIALIZE: Serialization of query results
  • CHOP: Chopping of XML whitespaces
  • ENTITY: Parsing of XML entities
  • TEXTINDEX: Text indexing
  • ATTRINDEX: Attribute value indexing
  • FTINDEX: Full-text indexing
  • PATHINDEX: Path indexing

SHOW

SHOW [DATABASES|SESSIONS|USERS|BACKUPS]

Shows server information:

  • DATABASES: shows currently opened databases.
  • SESSIONS: shows current database sessions.
  • USERS (ON [db]): shows users (on a database).
  • BACKUPS: shows backups.

XQUERY

XQUERY [query]

Evaluates the specified query and prints the result.