Difference between revisions of "Commands"

From BaseX Documentation
Jump to navigation Jump to search
Line 31: Line 31:
  
 
Creates a new database, index or user:
 
Creates a new database, index or user:
* '''<code>DATABASE [name] ([input]):</code>'''
+
* '''<code>DATABASE '''[<code>name]</code>''' ('''[<code>input]</code>'''):</code>'''
:creates the database [name] with an optional [input]
+
:creates the database '''[<code>name]</code>''' with an optional '''[<code>input]</code>'''
* '''<code>INDEX [TEXT|ATTRIBUTE|FULLTEXT|PATH]: </code>'''
+
* '''<code>INDEX '''[<code>TEXT|ATTRIBUTE|FULLTEXT|PATH]</code>''': </code>'''
 
:creates the specified index
 
:creates the specified index
* '''<code>FS [name] [path] ([mountpoint] [backingstore]): </code>'''
+
* '''<code>FS '''[<code>name]</code>''' '''[<code>path]</code>''' ('''[<code>mountpoint]</code>''' '''[<code>backingstore]</code>'''): </code>'''
:creates filesystem database [name] for [path]</code>'''
+
:creates filesystem database '''[<code>name]</code>''' for '''[<code>path]</code>'''</code>'''
:(using [mountpoint] and [backingstore] if FUSE is activated)
+
:(using '''[<code>mountpoint]</code>''' and '''[<code>backingstore]</code>''' if FUSE is activated)
* '''<code>USER [name] ([password]): </code>'''
+
* '''<code>USER '''[<code>name]</code>''' ('''[<code>password]</code>'''): </code>'''
 
:creates the specified user
 
:creates the specified user
  

Revision as of 00:40, 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:

Database Commands

Create

CREATE [DB|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])
  • USER [name] ([password])
  • USER [name] ([password])
  • USER [name] ([password])
creates the specified user

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

Open

OPEN [name]
Opens the specified database [name].


Add

ADD (AS [name]) (TO [target]) [input]
Adds [input] as [name] to the database, using an optional [target] path.


Delete

DELETE [name]
Deletes documents from the current database.

Info

INFO ([DB|INDEX|STORAGE])
Shows information on the currently opened database
  • no argument: show global information
  • DB: shows database information
  • INDEX: shows index information
  • STORAGE [start end] | [query]: show internal database table
what is start end?

Close

CLOSE
Closes the current database.


List

LIST
Lists all available databases.


Drop

DROP [DB|INDEX|USER] [...]
Drops a database, index or user:
DB [name]
drops the database
INDEX [PATH|TEXT|ATTRIBUTE|FULLTEXT]
drops the specified index
USER [name]
drops the specified user


Export

EXPORT [path]
Exports the database to [path].


Optimize

OPTIMIZE
Optimizes the current database structures.


Query Commands

Moved to own section.

Admin Commands

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.


Grant

GRANT [NONE|READ|WRITE|CREATE|ADMIN] (ON [db]) TO [user]
Grants permissions (on a database) to a user.


Alter

ALTER [USER|DB] [...]
Alters user password or database name:
USER [name] ([password])
alters the password of a user.
DB [name] [newname]
alters the name of a database.


Kill

KILL [name]
Kills all sessions of the specified user.


Backup

BACKUP [name]
Creates a backup of the specified database.


Restore

RESTORE [name]
Restores a backup of the specified database.


General Commands

Set

Have a look into Settings to find a complete list of available options.

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
  • WRITEBACK: Propagating changes to input file

Password

PASSWORD ([password])
Changes the user's password.

Help

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

Exit

EXIT
Exits BaseX.