Changes

Jump to navigation Jump to search
2,448 bytes added ,  16:07, 16 February 2014
Add example on how to bind and use a variable for a Command Script
This article page is part of linked from the [[Getting Started]] Section.It lists all database commands supported by BaseX.Commands can e.g. be executed from the [[Command-Line Options#BaseX_Standalone|Command Line]],[[#Command Scripts|Scripts]], the [[Clients]], [[REST]], the input field in the [[GUI]]and other ways. If the GUI is used, all commands that are triggered by the GUI itselfwill show up in the [[GUI#Visualizations|Info View]].The [[User_Management|Permission]] fields indicate whichrights are required by a user to perform a command in the client/server architecture.
=Basics=The options listed on this page influence the way how database [[Commands|commands]] are executed and XQuery expressions are evaluated. Options are divided into [[#Global Options|'''global options''']], which are valid for all BaseX instances, and '''local options''', which are specific to a client or session. Values of options are either ''strings'', ''numbers'' or ''booleans''.
==Command Scripts==The {{Code|.basex}} [[Configuration#Configuration Files|configuration file]] is parsed by every new local BaseX instance. It contains all global options and, optionally, local options at the end of the file.
Database commands in both the string and XML syntax can be placed in a text file and stored on disk. The default extension for BaseX command scripts is {{Code|.bxs}}. If the path to a command script is passed on Various ways exist to BaseX, it will automatically be recognized access and evaluated as such.change options:
==String Syntax==* The current value of an option can be requested with the [[Commands#GET|GET]] and changed with the [[Commands#SET|SET]] command. All values are ''static'': they stay valid until they are changed once again by another operation. If an option is of type ''boolean'', and if no value is specified, its existing value will be inverted.
Multiple commands * Initial values for options can also be written in a single specified via system properties, which can e.g. be passed on with the [http://docs.oracle.com/javase/1.4.2/docs/tooldocs/windows/java.html#options -D flag] on command line and separated by semicolons, or stored as command scriptusing [http://docs.oracle.com/javase/6/docs/api/java/lang/System. Lines starting with <code>html#</code> are interpreted as comments and are skippedsetProperty(java.lang.String,%20java.lang.String) System.setProperty()] before creating a BaseX instance. The following script creates a database, adds two documents specified keys needs to it and performs a querybe prefixed with {{Code|org.basex.}}. An example:
<pre class="brush:xmlbash">CREATE DB testADD inputjava -Dorg.basex.CHOP=false -cp basex.jar org.xmlADD TO embeddedbasex.xml <root>embedded</root># run queryBaseX -c"get chop"XQUERY count(//text())CHOP: false
</pre>
==XML Syntax==* Options can also be set in the prolog of an XQuery expression. In the option declaration, options need to be bound to the [[Database Module]] namespace. All values will be reset after the evaluation of a query:
The string syntax is limited when XML snippets need to be embedded in a command,<pre class="brush:xquery">or when complex queries are to be specifieddeclare option db:chop 'false';...</pre>
This is why database commands * Options can also be specified in XML.Multiple commands can be enclosed applied locally by a {{Code|<commands/>}} root elementusing pragmas:
<pre class="brush:xmlxquery"><commands> <create(# db:chop false #) { parse-db name=xml('test'/> <addxml>input.xmlhi </addxml> <add path='embedded.xml'><root>embedded</root></add> <xquery>count(//text())</xquery></commands>}
</pre>
==Glob Syntax==If options are implicitly changed by operations in the [[GUI]], the underlying commands will be listed in the [[GUI#Visualizations|Info View]].<br/><br/>
Some commands support the glob syntax to address more than one database or user. Question marks and asterisks can be used to match one or more characters, and commas can be used to separate multiple patterns. Some examples:=Global Options=
* {{Code|AB?}} addresses all names with Global options are constants. They can only be set in the characters configuration file or via system properties (see above). One exception (since {{CodeVersion|AB}} and one more character7.* {{Code|*AB8}} addresses all names ending with ) is the characters {{Code|AB}}.* {{Code[[#debug|X*DEBUG]] option,Y*,Z*}} addresses all names starting which can also be changed at runtime by users with the characters {{Code|X}}, {{Code[[User Management|Y}}, or {{Code|Z}}admin permissions]].
==Valid NamesGeneral==
Database, user and event names follow the same naming constraints: Names are restricted to ASCII characters. They must at least have one character, and they may contain letters, numbers and any of the special characters <code>!#$%&'()+-=@[]^_`{}~</code>. The following characters are reserved for other features:==DEBUG===
* <code>,?*</code>: {| width='100%'|-| width='120' | '''Signature'''|{{Code|DEBUG [[#Glob Syntaxboolean]}}|-| '''Default'''|{{Code|false}}|-|glob syntax]]'''Summary'''* <code>;</code>: Separator |Sends internal debug info to STDERR. This option can be turned on to get additional information for multiple database commands development and debugging purposes. It can also be triggered on the [[Command-Line Options#BaseX Standalone|command line]]* via <code>\/-d</code>: Directory path separators* <code>.</code>: hidden folders (e.g. the [[Logging|.logs directory]])* <code>:*?\"<>|}</code>: invalid filename characters on Windows
==Aliases=DBPATH==={| width='100%'|-| width='120' | '''Signature'''|{{Code|DBPATH [path]}}|-| '''Default'''|<code>[[Configuration#Database Directory|{home}/BaseXData]]</code> or <code>[[Configuration#Database Directory|{home}/data]]</code>|-| '''Summary'''|Points to the directory in which all databases are located.|}
In all commands, the ===REPOPATH==={{Code|DB}} keyword can be replaced by width='100%'|-| width='120' | '''Signature'''|{{Code|DATABASEREPOPATH [path]}}.|-| '''Default'''=|<code>[[Configuration#Database Operations=Directory|{home}/BaseXRepo]]</code>|-| '''Summary'''|Points to the [[Repository]], in which all XQuery modules are located.|}
==CREATE DB=LANG===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|CREATE DB LANG [namelanguage] ([input])}}
|-
| '''XML&nbsp;SyntaxDefault'''&nbsp;&nbsp;&nbsp;|<code><create-db name='...'>([input])</create-db></code><br/>{{Code|English}}
|-
| '''PermissionSummary'''|Specifies the interface language. Currently, seven languages are available: 'English'CREATE, 'German', 'French', 'Dutch', 'Italian', 'Japanese', and 'Vietnamese'.|} ===LANGKEY==={| width='100%'
|-
| width='120' | '''SummarySignature'''|Creates the database {{Code|[name]}} with an optional {{Code|LANGKEY [inputboolean]}} and opens it. An existing database will be overwritten.<br />The input may either be a reference to a single XML document, a directory, a remote URL, or a string containing XML:* {{Code|[name]}} must be a [[#Valid Names|valid database name]]* several additional [[Options#Create Options|Create Options]] can be set to influence the creation process.
|-
| '''ErrorsDefault'''|The command fails if a database with the specified name is currently used by another process, if one of the documents to be added is not well-formed or if it cannot be parsed for some other reason.{{Code|false}}
|-
| '''ExamplesSummary'''|* {{Code|CREATE DB input}}<br/>creates an empty database {{Code|input}}.* {{Code|CREATE DB xmark http://files.basex.org/xml/xmark.xml}}<br/>creates the database {{Code|xmark}}, containing a single initial document called {{Code|xmark.xml}}.* {{Code|CREATE DATABASE coll /path/to/input}}<br/>creates the database {{Code|coll}} Prefixes all texts with all documents found in the {{Code|input}} directory.* {{Code|SET INTPARSE false; CREATE DB input inputinternal language keys.xml}}<br/>creates a database {{Code|input}} with {{Code|input.xml}} as initial documentThis option is helpful if BaseX is translated into another language, which will be parsed with Java's [[Parsers#XML Parsers|default XML parser]].* <code><create-db name='simple'><hello>Universe</hello></create-db></code><br/>creates a database named {{Code|simple}} with an initial document {{Code|<hello>Universe</hello>}}and if you want to see where particular texts are displayed.
|}
==OPEN=GLOBALLOCK===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|OPEN GLOBALLOCK [nameboolean]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><open name='...'/></code>
|-
| '''PermissionDefault'''|''READ''{{Code|false}}
|-
| '''Summary'''
|Opens the database specified by {{Code|[name]}}.|-| '''Errors'''|The command fails Controls if the specified local (database does not exist, is currently being updated by another ) or global (process or cannot ) locking will be opened used for some other reasonmanaging read and write operations. The article on [[Transaction Management]] provides more details on concurrency control.
|}
==CHECKClient/Server Architecture==
===HOST===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|CHECK HOST [inputhost]}}
|-
| '''XML&nbsp;SyntaxDefault'''&nbsp;&nbsp;&nbsp;|<code><check input='...'/></code><br/>{{Code|localhost}}
|-
| '''PermissionSummary'''|This host name is used by the client when connecting to a server. This option can also be changed when running the client on [[Command-Line Options#BaseX Client|command line]] via <code>-n</code>.|} ===PORT==={| width='100%'|-| width='120' | '''Signature'''|{{Code|PORT [port]}}|-|''READ/CREATE'Default'''|{{Code|1984}}
|-
| '''Summary'''
|This convenience command combines port is used by the client when connecting to a server. This option can also be changed when running the client on [[Command-Line Options#OPENBaseX Client|OPENcommand line]] and [[#CREATE DB|CREATE DB]]: if a database with the name {{Code|[input]}} exists, it is opened. Otherwise, a new database is created; if the specified input points to an existing resource, it is stored as initial content.|via <code>-| '''Errors'''|The command fails if the addressed database could neither be opened nor createdp</code>.
|}
==CLOSE=SERVERPORT===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|CLOSE SERVERPORT [port]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><close/></code><br/>
|-
| '''PermissionDefault'''|''READ''{{Code|1984}}
|-
| '''Summary'''
|Closes This is the port the currently opened databaseserver will be listening to.|This option can also be changed when running the server on [[Command-| '''Errors'''Line Options#BaseX Server|The command fails if the database files could not be closed for some reasonline]] via <code>-p</code>.
|}
==EXPORT=EVENTPORT===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|EXPORT EVENTPORT [pathport]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><export path='...'/></code><br/>
|-
| '''PermissionDefault'''|''CREATE''{{Code|1985}}
|-
| '''Summary'''
|Exports all documents in This port is used by the database client to the specified file {{Codelisten for [[Events|[pathserver events]]}}, using . It will only be bound if a client attaches itself to a database event. This option can also be changed when running the serializer options specified by the <code>server on [[Command-Line Options#EXPORTERBaseX Server|EXPORTERcommand line]]via <code>-e</code> option.|-| '''Errors'''|The command fails if no database is opened, if the target path points to a file or is invalid, if the serialization parameters are invalid, or if the documents cannot be serialized for some other reason.
|}
==CREATE INDEX=USER=== 
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|CREATE INDEX USER [TEXT&#x7c;ATTRIBUTE&#x7c;FULLTEXTname]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code>&lt;create-index type='text&#x7c;attribute&#x7c;fulltext'/&gt;</code><br/>
|-
| '''PermissionDefault'''|''WRITEempty''
|-
| '''Summary'''
|Creates Represents a user name, which is used for accessing the specified database [[Indexes|index]].server or an HTTP service:|-| '''Errors'''|* The command fails default value will be overwritten if no database a client specifies its own credentials.* If the default value is openedempty, login will only be possible if the specified index is unknown, or if indexing fails for some other reasonclient specifies credentials.* The option can also be changed on [[Command-Line Options#BaseX Client|command line]] via <code>-U</code>.
|}
==DROP INDEX=PASSWORD=== 
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|DROP INDEX PASSWORD [TEXT&#x7c;ATTRIBUTE&#x7c;FULLTEXTpassword]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><drop-index type='text&#x7c;attribute&#x7c;fulltext'/></code><br/>
|-
| '''PermissionDefault'''|''WRITEempty''
|-
| '''Summary'''
|Drops Represents a password, which is used for accessing the server or an HTTP service:* The default value will be overwritten if a client specifies its own credentials.* If the default value is empty, login will only be possible if the specified database client specifies credentials.* The option can also be changed on [[IndexesCommand-Line Options#BaseX Client|indexcommand line]]via <code>-P</code>.|-| '''Errors'''|The command fails if no database * Please note that it is opened, if the specified index is unknown, or if it could not be deleted for some other reasona security risk to specify your password in plain text.
|}
=Administration= =SERVERHOST=ALTER DB==
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|ALTER DB SERVERHOST [name] [newnamehost&#x7c;ip]}}
|-
| '''XML&nbsp;SyntaxDefault'''&nbsp;&nbsp;&nbsp;|<code><alter-db name='...' newname=empty'...'/></code><br/>
|-
| '''PermissionSummary'''|This is the host name or ip address the server is bound to. If the option is set to an empty string (which is the default), the server will be open to all clients.|} ===PROXYHOST==={| width='100%'CREATEwidth='100%'
|-
| width='120' | '''SummarySignature'''|Renames the database specified by {{Code|[name]}} to {{Code|[newname]}}. {{Code|PROXYHOST [newnamehost]}} must be a [[#Valid Names|valid database name]].
|-
| '''ErrorsDefault'''|The command fails if the target database already exists, if the source database does not exist or is currently locked, or if it could not be renamed for some other reason.''empty''
|-
| '''ExamplesSummary'''|* {{Code|ALTER DB db tempdb}}<br/>renames This is the database {{Code|db}} into {{Code|tempdb}}host name of a proxy server.
|}
==DROP DB=PROXYPORT===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|DROP DB PROXYPORT [nameport]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><drop-db name='...'/></code><br/>
|-
| '''PermissionDefault'''|''CREATE''{{Code|80}}
|-
| '''Summary'''
|Drops the database with the specified {{Code|[name]}}. The [[#Glob Syntax|Glob Syntax]] can be used to address more than one database.|-| '''Errors'''|The command fails if the specified database does not exist or This is currently locked, or if the database could not be deleted for some other reasonport number of a proxy server.
|}
==CREATE BACKUP=NONPROXYHOSTS===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|CREATE BACKUP NONPROXYHOSTS [namehosts]}}
|-
| '''XML&nbsp;SyntaxDefault'''&nbsp;&nbsp;&nbsp;|<code><create-backup name='...'/></code><br/>empty''
|-
| '''PermissionSummary'''|This is a list of hosts that should be directly accessed.|} ===TIMEOUT==={| width=''CREATE'100%'
|-
| width='120' | '''SummarySignature'''|Creates a zipped backup of the database specified by {{Code|TIMEOUT [nameseconds]}}. The backup file will be suffixed with the current timestamp and stored in the database directory. The [[#Glob Syntax|Glob Syntax]] can be used to address more than one database.<br/>Please note that Java 7 is required to handle ''ZIP files larger than 4 GB''.
|-
| '''ErrorsDefault'''|The command fails if the specified database does not exist, or if it could not be zipped for some other reason.{{Code|30}}
|-
| '''ExamplesSummary'''|* {{Code|BACKUP db}}<br/>creates Specifies the maximum time a zip archive read-only transaction may take. If an operation takes longer than the specified timeout, it will be aborted. Write operations will not be affected by this timeout, as this would corrupt the integrity of the database . The timeout is deactivated if the timeout is set to {{Code|db0}} (e.g. It is ignored for {{Code|db-2011-04-01-12-27-28.zipADMIN}}) in the [[Configuration#Database_Directory|database directory]]operations.
|}
==RESTORE=KEEPALIVE===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|RESTORE KEEPALIVE [nameseconds]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><restore name='...'/></code><br/>
|-
| '''PermissionDefault'''|''CREATE''{{Code|600}}
|-
| '''Summary'''
|Restores Specifies the maximum time a database client will be remembered by the server. If there has been no interaction with a client for a longer time than specified by this timeout, it will be disconnected. Running operations will not be affected by this option. The keepalive check is deactivated if the specified value is set to {{Code|[name]0}}. The name may include the timestamp of the backup file.|-| '''Errors'''|The command fails if the specified backup does not exist, if the database to be restored is currently locked, or if it could not be restored for some other reason.
|}
==INSPECT=PARALLEL=== 
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|INSPECTPARALLEL [number]}}
|-
| '''XML&nbsp;SyntaxDefault'''&nbsp;&nbsp;&nbsp;|<code><inspect/></code>|-{{Code| '''Permission'''|''READ''8}}
|-
| '''Summary'''
|Performs some integrity checks on Denotes the opened database maximum allowed {{Code|number}} of parallel [[Transaction Management|transactions]].<br/>Note that a higher number of parallel operations may increase disk activity and returns thus slow down queries. In some cases, a brief summarysingle transaction may even give you better results than any parallel activity.
|}
==DROP BACKUP=LOG===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|DROP BACKUP LOG [nameboolean]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><drop-backup name='...'/></code><br/>
|-
| '''PermissionDefault'''|''CREATE''{{Code|true}}
|-
| '''Summary'''
|Drops all backups of the database with the specified {{Code|Turns [[nameLogging]}}] of server operations and HTTP requests on/off. The This option can also be changed when running the server on [[Command-Line Options#Glob SyntaxBaseX Server|Glob Syntaxcommand line]] can be used to address more than one database.|via <code>-| '''Examples'''|* {{Code|DROP BACKUP abc*}}z<br/code>deletes the backups of all databases starting with the characters {{Code|abc}}.
|}
==SHOW BACKUPS=LOGMSGMAXLEN===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|SHOW BACKUPSLOGMSGMAXLEN [length]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><show-backups/></code><br/>
|-
| '''PermissionDefault'''|''CREATE''{{Code|1000}}
|-
| '''Summary'''
|Shows all database backupsSpecifies the maximum length of a single [[Logging|log message]].
|}
==COPYHTTP Options== If BaseX is run as [[Web Application]], the HTTP options are either determined by the web server, or specified in the <code>[https://github.com/BaseXdb/basex-api/tree/master/src/main/webapp/WEB-INF webapp/WEB-INF]</code> directory and the {{Code|jetty.xml}} and {{Code|web.xml}} configuration files. ===WEBPATH===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|COPY WEBPATH [name] [newnamepath]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><copy name='...' newname='...'/></code><br/>
|-
| '''PermissionDefault'''|''CREATE''<code>[[Configuration#Database Directory|{home}/BaseXWeb]]</code> or <code>[[Configuration#Database Directory|{home}/webapp]]</code>
|-
| '''Summary'''
|Creates a copy of Points to the directory in which all the database specified by {{Code|[name[Web Application]}}. {{Code|[newname]}} must be a contents are stored, including XQuery, Script, [[#Valid Names|valid database nameRESTXQ]].|-| '''Errors'''|The command fails if the target database already exists, or if the source database does not existand configuration files.
|}
==INFO DB=RESTXQPATH===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|INFO DBRESTXQPATH [path]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><info-db/></code><br/>
|-
| '''PermissionDefault'''|''READempty''
|-
| '''Summary'''
|Shows information on Points to the currently opened databasedirectory which contains the [[RESTXQ]] modules of a web application.|-| '''Errors'''Relative paths will be resolved against the [[#WEBPATH|The command fails if no database is openedWEBPATH]] directory.
|}
==INFO INDEX=HTTPLOCAL===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|INFO INDEX (HTTPLOCAL [TAG&#x7c;ATTNAME&#x7c;PATH&#x7c;TEXT&#x7c;ATTRIBUTE&#x7c;FULLTEXTboolean])}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><info-index type='tag&#x7c;attname&#x7c;path&#x7c;text&#x7c;attribute&#x7c;fulltext'/></code><br/>
|-
| '''PermissionDefault'''|''READ''{{Code|false}}
|-
| '''Summary'''
|Shows information on By default, a database server instance will be opened along with the web server. If the existing flag is set to {{Code|true}}, all commands will be executed in an embedded database context.<br/>If BaseX is run as [[Indexes|indexWeb Application]] structures. The output can be optionally limited to , and if the specified index.|-flag is {{Code| '''Errors'''|The command fails if no database is openedfalse}}, or if the specified index server will be started as soon as the first HTTP service is unknowncalled.
|}
==INFO STORAGE=STOPPORT===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|INFO STORAGE STOPPORT [start end] &#x7c; [queryport]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><info-storage>([query])</info-storage></code><br/>
|-
| '''PermissionDefault'''|''READ''{{Code|8985}}
|-
| '''Summary'''
|Shows This is the internal main table of port on which the currently opened database. An integer range or a query may [[Startup#BaseX HTTP Server|HTTP Server]] can be locally closed:* The listener for stopping the web server will only be started if the specified as argumentvalue is greater than {{Code|0}}.|-| '''Errors'''|* The command fails option is ignored if no database BaseX is opened, used as a [[Web Application]] or if one of started via [[Web Application#Maven|Maven]].* This option can also be changed when running the specified arguments is invalidHTTP server on [[Command-Line Options#BaseX Server|command line]] via <code>-s</code>.
|}
= Querying Create Options=
==LISTGeneral==
===MAINMEM===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|LIST (MAINMEM [nameboolean] ([path]))}}|-| '''Default'''|{{Code|false}}|-| '''Summary'''|If this option is turned on, new databases will be exclusively created in main memory. Most queries will be evaluated faster in main memory mode, but all data is lost if BaseX is shut down. The value of this option will be assigned once to a new database, and cannot be changed after that.|} ===ADDCACHE=== {| width='100%'
|-
| width='120' | '''XML&nbsp;SyntaxSignature'''&nbsp;&nbsp;&nbsp;|<code><list (name='...' (path='...'))/></code><br/>{{Code|ADDCACHE [boolean]}}
|-
| '''PermissionDefault'''|''NONE''{{Code|false}}
|-
| '''Summary'''
|Lists all available databases. If {{Codethis option is activated, documents that are added via [[Commands#ADD|[nameADD]]}} is specified, will first be cached to disk before being added to the resources of a final database . This option is helpful when larger documents are listed. The output can to be further restricted to imported, and if the existing heuristics cannot estimate the resources matching size of the specified input (e.g. when adding directories).|} ==Parsing== ===CREATEFILTER==={| width='100%'|-| width='120' | '''Signature'''|{{Code|CREATEFILTER [pathfilter]}}|-| '''Default'''|{{Code|*.xml}}
|-
| '''ErrorsSummary'''|The command fails if File filter in the optional database cannot be opened[[Commands#Glob Syntax|Glob Syntax]], which is applied whenever new databases are created, or if the existing databases cannot be listed for some other reasonresources are added to a database.
|}
==XQUERY=ADDARCHIVES===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|XQUERY ADDARCHIVES [queryboolean]}}
|-
| '''XML&nbsp;SyntaxDefault'''&nbsp;&nbsp;&nbsp;|<code><xquery>[query]</xquery></code><br/>{{Code|true}}
|-
| '''PermissionSummary'''|If this option is set to {{Code|true}}, files within archives (ZIP, GZIP, DOCX, etc.) are parsed whenever new database are created or resources are added to a database.|} ===SKIPCORRUPT==={| width=''depends on query'100%'
|-
| width='120' | '''SummarySignature'''|Runs the specified {{Code|SKIPCORRUPT [queryboolean]}} and prints the result.
|-
| '''ErrorsDefault'''|The command fails if the specified query is invalid.{{Code|false}}
|-
| '''ExamplesSummary'''|* {{Code|XQUERY 1 to 10}}<br/>returns the sequence {{Code|Skips corrupt (1i.e., 2not well-formed) files while creating a database or adding new documents. If this option is activated, 3document updates are slowed down, 4, 5, 6, 7, 8, 9, 10)}}as all files will be parsed twice.* {{Code|SET RUNS 10; XQUERY 1 to 10}}<br/>runs the query 10 timesNext, returns the result and prints the average execution time.* {{Code|SET XMLPLAN true; XQUERY 1 to 10}}<br/>returns the result and prints the query plan main memory consumption will be higher as XMLparsed files will be cached in main memory.
|}
==RETRIEVE=ADDRAW===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|RETRIEVE ADDRAW [pathboolean]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><retrieve path='...'/></code><br/>
|-
| '''PermissionDefault'''|''READ''{{Code|false}}
|-
| '''Summary'''
|Retrieves If this option is activated, and if new resources are added to a raw file from the opened database at , all files that are not filtered by the specified {{Code[[#CREATEFILTER|[pathCREATEFILTER]]}}.|-| option will be added as ''raw'Errors'''|The command fails if no database is openedfiles (i.e., if the source path is invalid or if the data cannot not be retrieved for some other reasonin their binary representation).
|}
==FIND=PARSER===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|FIND PARSER [querytype]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><find>[query]</find></code><br/>
|-
| '''PermissionDefault'''|''READ''{{Code|XML}}
|-
| '''Summary'''
|Builds and runs Defines a query [[Parsers|parser]] for importing new files to the specified {{Code|[query]}} termsdatabase. Keywords can be enclosed in quotes to look for phrasesCurrently, 'XML', 'JSON', 'CSV', 'TEXT', 'HTML' are available as parsers. The following modifiers can HTML will be used to further limit searchparsed as normal XML files if [http:<code>=</code> looks for exact text nodes<br/><code>home.ccil.org/~<cowan/code> looks for approximate hits<brXML/><code>@=<tagsoup/code> looks for exact attribute values<br/><code>@</code> looks for attributes|-| '''Errors'''|The command fails if no database Tagsoup] is openednot found in the classpath.
|}
==CS=CSVPARSER=== Introduced with {{Mark|Version 7.8:}} 
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|CS CSVPARSER [queryoptions]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><cs>[query]</cs></code><br/>
|-
| '''PermissionDefault'''|''depends on queryempty''
|-
| '''Summary'''
|Evaluates Specifies the specified {{Code|[query]}} and declares the resulting nodes as new ''context set''way how CSV data is to be parsed. In subsequent queries, the context set will be The available via options are listed in the context item expression of XQuery ({{Code[[CSV Module#Options|.}}).|-| '''Errors'''|The command fails if no database is opened, if the specified query is invalid or if it does not return nodes of the currently opened databaseCSV Module]].
|}
==REPO INSTALL=JSONPARSER=== Introduced with {{Mark|Version 7.8:}} 
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|REPO INSTALL JSONPARSER [pathoptions]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><repo-install path='...'/></code><br/>
|-
| '''PermissionDefault'''|''CREATEempty''
|-
| '''Summary'''
| Installs Specifies the package with path {{Code|[path]}}.|-| '''Errors'''| The command fails in the following cases:* The package to be installed way how JSON data is not a xar file.* The package to be installed does not exist or is already installedparsed.* The package descriptor is with invalid syntax.* The package to be installed depends on a package which is not installed.* The package is not supported by available options are listed in the current version of BaseX.* A component of the package is already installed as part of another package[[JSON Module#Options|JSON Module]].
|}
==REPO LIST=TEXTPARSER=== Introduced with {{Mark|Version 7.8:}} 
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|REPO LISTTEXTPARSER [options]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><repo-list/></code><br/>
|-
| '''PermissionDefault'''|''READempty''
|-
| '''Summary'''
| Lists all installed packagesSpecifies the way how TEXT data is to be parsed. Available options are listed in the article on [[Parsers]].
|}
==REPO DELETEXML Parsing== ===CHOP===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|REPO DELETE CHOP [nameboolean]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><repo-delete name='...'/></code><br/>
|-
| '''PermissionDefault'''|''CREATE''{{Code|true}}
|-
| '''Summary'''
| Deletes the package with name Chops all leading and trailing whitespaces from text nodes while building a database, and discards empty text nodes. By default, this option is set to {{Code|[name]true}}, optionally followed as it often reduces the database size by a versionup to 50%.|It can also be turned off on [[Command-| '''Errors'''Line Options#BaseX Standalone| The command fails if the package to be deleted participates in a dependencyline]] via <code>-w</code>.
|}
=Updates==INTPARSE=== {{Mark|Updated with Version 7.8}}: default is now {{Code|false}}.
==ADD==
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|ADD (TO INTPARSE [path]) [inputboolean]}}
|-
| '''XML&nbsp;SyntaxDefault'''&nbsp;&nbsp;&nbsp;|<code><add (path='...')>[input]</add></code><br/>{{Code|false}}
|-
| '''PermissionSummary'''|Uses the internal XML parser instead of the standard Java XML parser. The internal parser is faster, more fault tolerant and supports common HTML entities out-of-the-box, but it does not support all features needed for parsing DTDs.|} ===DTD==={| width=''WRITE'100%'
|-
| width='120' | '''SummarySignature'''|Adds a file, directory or XML string specified by {{Code|[input]}} to the currently opened database at the specified {{Code|[path]}}. A document with the same path may occur than once in a database. If this is unwanted, [[#REPLACE|REPLACE]] can be used.<br/>{{Code|DTD [inputboolean]}} may either be a single XML document, a directory, a remote URL or a plain XML string.
|-
| '''ErrorsDefault'''|The command fails if no database is opened, if one of the documents to be added is not well-formed, or if it could not be parsed for some other reason.{{Code|false}}
|-
| '''ExamplesSummary'''|* {{Code|ADD inputParses referenced DTDs and resolves XML entities.xml}}<br/>adds the file {{Code|input.xml}} By default, this option is switched to the database.* {{Code|ADD TO temp/one.xml input.xmlfalse}}<br/>adds {{Code|input.xml}} to , as many DTDs are located externally, which may completely block the database and moves it to {{Code|temp/one.xml}}process of creating new databases.* {{CodeThe [[#CATFILE|ADD TO target/ xmldir}}<br/>adds all files from the {{Code|xmldir}} directory CATFILE]] option can be changed to the database in the {{Code|target}} pathlocally resolve DTDs.
|}
==DELETE=CATFILE===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|DELETE CATFILE [path]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><delete path='...'/></code><br/>
|-
| '''PermissionDefault'''|''WRITEempty''
|-
| '''Summary'''
|Deletes all documents from Specifies a catalog file to locally resolve DTDs; see the currently opened database that start with the specified {{Code|entry on [[pathCatalog Resolver]]}}.|-| '''Errors'''|The command fails if no database is openeds for more details.
|}
==RENAMEIndexing== The current index and full-text index options will be stored in a new database, and take effect if indexes are rebuilt via the [[Commands#OPTIMIZE|OPTIMIZE]]. ===TEXTINDEX===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|RENAME TEXTINDEX [path] [newpathboolean]}}
|-
| '''XML&nbsp;SyntaxDefault'''&nbsp;&nbsp;&nbsp;|<code><rename path='...' newpath='...'/></code><br/>{{Code|true}}
|-
| '''PermissionSummary'''|Creates a text index whenever a new database is created. A text index speeds up queries with equality comparisons on text nodes; see [[Indexes]] for more details.|} ===ATTRINDEX==={| width=''WRITE'100%'
|-
| width='120' | '''SummarySignature'''|Renames all document paths in the currently opened database that start with the specified {{Code|ATTRINDEX [pathboolean]}}. The command may be used to either rename single documents or directories.
|-
| '''ErrorsDefault'''|The command fails if no database is opened, or if the target path is empty.{{Code|true}}
|-
| '''ExamplesSummary'''|* {{Code|RENAME oneCreates an attribute index whenever a new database is created.xml two.xml}}<br/>renames the document {{Code|one.xml}} to {{Code|two.xml}}.* {{Code|RENAME / TOP}}<br/>moves all documents to a {{Code|TOP}} root directoryAn attribute index speeds up queries with equality comparisons on attribute values; see [[Indexes]] for more details.
|}
==REPLACE=FTINDEX===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|REPLACE FTINDEX [path] [inputboolean]}}
|-
| '''XML&nbsp;SyntaxDefault'''&nbsp;&nbsp;&nbsp;|<code><replace path='...'>[input]</replace></code><br/>{{Code|false}}
|-
| '''PermissionSummary'''|Creates a full-text index whenever a new database is created. A full-text index speeds up queries with full-text expressions; see [[Indexes]] for more details.|} ===MAXLEN==={| width=''WRITE'100%'
|-
| width='120' | '''SummarySignature'''|Replaces a document in the currently opened database, addressed by {{Code|[path]}}, with the file or XML string specified by {{Code|MAXLEN [inputint]}}, or adds a new document if the resource does not exist yet.
|-
| '''ErrorsDefault'''|The command fails if no database is opened, if the specified path points to a database directory, or if the input is not found.{{Code|96}}
|-
| '''ExamplesSummary'''|* {{Code|REPLACE one.xml input.xml}}<br/>replaces Specifies the document {{Code|one.xml}} with the contents maximum length of strings that are to be indexed by the file {{Code|inputname, path, value, and full-text index structures.xml}}.* {{Code|REPLACE top.xml &lt;xml/&gt;}}<br/>replaces the document {{Code|top.xml}} with the document {{Code|&lt;xml/&gt;}}The value of this option will be assigned once to a new database, and cannot be changed after that.
|}
==STORE=MAXCATS===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|STORE (TO MAXCATS [path]) [inputint]}}
|-
| '''XML&nbsp;SyntaxDefault'''&nbsp;&nbsp;&nbsp;|<code><store (path='...')>[input]</store></code><br/>{{Code|-| '''Permission'''|''WRITE''100}}
|-
| '''Summary'''
|Stores a raw file Specifies the maximum number of distinct values (categories) that will be stored together with the element/attribute names or unique paths in the opened database to the specified {{Code[[Index#Name Index|Name Index]] or [path[Index#Path Index|Path Index]]}}. {{Code|[input]}} may either The value of this option will be a file reference, a remote URL, or a plain string. If the path denotes a directory, it needs assigned once to be suffixed with a slash ({{Code|/}}).|-| '''Errors'''|The command fails if no new database is opened, if the specified resource is not found, if the target path is invalid or if the data and cannot not be written for some other reasonchanged after that.
|}
==OPTIMIZE=UPDINDEX===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|OPTIMIZE (ALL)UPDINDEX [boolean]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><optimize/></code><br/><code><optimize-all/></code><br/>
|-
| '''PermissionDefault'''|''WRITE''{{Code|false}}
|-
| '''Summary'''
|Optimizes If turned on, incremental indexing will be activated:* with each update, the index structures, meta data text and statistics attribute value indexes will be updated as well.* The value of the currently opened this option will be assigned once to a new database, and cannot be changed after that. If the {{Code|ALL}} flag * The advantage of incremental indexes is specified, that the internal database value index structures are completely rebuilt; this often leads will always be up-to a reduction of the total database size-date.|-| '''Errors'''|* The command fails if no database downside is opened, or if the currently opened database is a main-memory instancethat updates will take longer. The article on [[Index#Updates|Index Structures]] includes additional details.
|}
==FLUSH=INDEXSPLITSIZE=== 
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|FLUSHINDEXSPLITSIZE [num]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><flush/></code><br/>
|-
| '''PermissionDefault'''|''WRITE''{{Code|0}}
|-
| '''Summary'''
|Explicitly flushes the buffers of This option affects the currently opened database to disk. This command is applied if [[OptionsIndexes#AUTOFLUSHIndex Construction|AUTOFLUSHconstruction]] has been set of new text and attribute indexes. It specifies the number of index build operations that are performed before writing partial index data to {{Code|false}}disk.|-| '''Errors'''|The command fails By default, if no database the value is openedset to 0, some dynamic split heuristics are applied.
|}
=Server Administration==FTINDEXSPLITSIZE===
==SHOW SESSIONS==
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|SHOW SESSIONSFTINDEXSPLITSIZE [num]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><show-sessions/></code><br/>
|-
| '''PermissionDefault'''|''ADMIN''{{Code|0}}
|-
| '''Summary'''
|Shows all sessions This option affects the [[Indexes#Index Construction|construction]] of new full-text indexes. It specifies the number of index build operations that are connected performed before writing partial index data to disk. By default, if the current server instancevalue is set to 0, some dynamic split heuristics are applied.
|}
==SHOW USERSFull-Text== ===STEMMING===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|SHOW USERS (ON STEMMING [databaseboolean])}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><show-users (database='...')/></code><br/>
|-
| '''PermissionDefault'''|''ADMIN''{{Code|false}}
|-
| '''Summary'''
|Shows A new full-text index will stem all tokens and speed up queries on stemmed tokens. The same stemming normalization will be applied to all users query tokens that are registered checked against tokens in the database. If a {{Code|[database]}} is specified, local users are shown.|-| '''Errors'''|The command fails if the optional database could not be openedthis index.
|}
==KILL=CASESENS===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|KILL CASESENS [targetboolean]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><kill target='...'/></code><br/>
|-
| '''PermissionDefault'''|''ADMIN''{{Code|false}}
|-
| '''Summary'''
|Kills sessions A new full-text index will preserve the case of a user or an IP:port combination, specified by {{Code|[target]}}all tokens. The [[#Glob Syntax|Glob Syntax]] can same case normalization will be used to address more than one user.|-| '''Errors'''|The command fails if a user tried applied to kill his/her own sessionall query tokens that are checked against tokens in this index.
|}
==CREATE EVENT=DIACRITICS===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|CREATE EVENT DIACRITICS [NAMEboolean]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><create-event name='...'/></code><br/>
|-
| '''PermissionDefault'''|''ADMIN''{{Code|false}}
|-
| '''Summary'''
|Creates A new full-text index will preserve the specified [[Events|event]]diacritics of all tokens.|-| '''Errors'''|The command fails if event already existssame diacritics normalization will be applied to all query tokens that are checked against tokens in this index.
|}
==SHOW EVENTS=LANGUAGE===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|SHOW EVENTSLANGUAGE [lang]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><show-events/></code><br/>
|-
| '''PermissionDefault'''|''ADMIN''{{Code|en}}
|-
| '''Summary'''
|Shows A new full-text index will use the given language to normalize all [[Events|events]] that have been registered in tokens. This option is mainly important if tokens are to be stemmed, or if the databasetokenization of a language differs from Western languages.
|}
==DROP EVENT=STOPWORDS===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|DROP EVENT STOPWORDS [NAMEpath]}}
|-
| '''XML&nbsp;SyntaxDefault'''&nbsp;&nbsp;&nbsp;|<code><drop-event name='...'/></code><br/>|-| '''Permission'''|''ADMINempty''
|-
| '''Summary'''
|Drops A new full-text index will drop tokens that are listed in the specified [[Eventsstopword list. A stopword list may decrease the size of the full text index. A standard stopword list for English texts is provided in the directory {{Code|event]]etc/stopwords.|-| '''Errors'''|The command fails if txt}} in the event doesn't existofficial releases.
|}
=User ManagementQuery Options=
==CREATE USER=QUERYINFO===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|CREATE USER QUERYINFO [nameboolean] (}}|-| '''Default'''|{{Code|false}}|-| '''Summary'''|Prints more information on internal query rewritings, optimizations, and performance. By default, this info is shown in the [password[GUI#Visualizations|Info View]])}in the GUI. It can also be activated on [[Command-Line Options#BaseX Standalone|command line]] via <code>-V</code>. |===XQUERY3==={| width='100%'
|-
| width='120' | '''XML&nbsp;SyntaxSignature'''&nbsp;&nbsp;&nbsp;|<code><create-user name='...'>([password])</create-user></code><br/>{{Code|XQUERY3}}
|-
| '''PermissionDefault'''|''ADMIN''{{Code|true}}
|-
| '''Summary'''
|Creates a user with the specified {{Code|Enables all [[nameXQuery 3.0]}} and {{Code|[password]}}features supported by BaseX. If this option is set to {{Code|[name]false}} must be a [[#Valid Names|valid user name]]. The password must be a valid MD5 hash value. If no password is specified in the console mode, it is requested via standard input.|-| '''Errors'''|The command fails if the specified user already exists, or if XQuery parser will only accept expressions of the password is no valid MD5 hash valueXQuery 1.0 specification.
|}
==ALTER USER=BINDINGS===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|ALTER USER BINDINGS [namevars] ([password])}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><alter-user name='...'>([password])</alter-user></code><br/>
|-
| '''PermissionDefault'''|''ADMINempty''
|-
| '''Summary'''
|Alters the {{Code|[password]}} of the user specified Contains external variables to be bound to a query:* Variable names and values are separated by equality signs, and multiple variables are delimited by {{Code|[name]}}commas. The password must * Variables may optionally be introduced with a valid MD5 hash leading dollar sign.* Commas that occur in the valueitself are encoded by duplication. * If no password is specified in a variable uses a namespace different to the console modedefault namespace, it is requested via standard inputcan be specified with the [http://www.jclark.com/xml/xmlns.htm Clark Notation] or [http://www.w3.org/TR/xquery-30/#id-basics Expanded QName Notation].* This option can also be used on [[Command-Line Options#BaseX Standalone|command line]] with the flag <code>-b</code>.
|-
| '''ErrorsExamples'''|The command fails if <code>$a=1,$b=2</code> &nbsp; binds the values {{Code|1}} and {{Code|2}} to the variables $a and $b<br/> <code>a=1,,2</code> &nbsp; binds the specified user does not existvalue {{Code|1, or if 2}} to the variable $a<br/> <code>{URI}a=x</code> &nbsp; binds the value {{Code|x}} to the variable $a with the namespace {{Code|URI}}. <pre class="brush:xml">SET BINDINGS BIND-VAR="hello world!"XQUERY declare variable $BIND-VAR external; $BIND-VAR</pre> &nbsp; binds the password is no valid MD5 hash value{{Code|hello world!}} to the variable $BIND-VAR and shows how it can be used in a [[Commands#Command_Scripts| Command Script]]
|}
==DROP USER=QUERYPATH===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|DROP USER QUERYPATH [namepath] }}|-| '''Default'''|''empty''|-| '''Summary'''|Contains the path (ON [database]''base URI'') to the executed query (default: ''empty''). This directory will be used to resolve relative paths to documents, query modules, and other resources addressed in a query.|} ===INLINELIMIT=== {{Mark|Introduced with Version 7.8:}}: {| width='100%'
|-
| width='120' | '''XML&nbsp;SyntaxSignature'''&nbsp;&nbsp;&nbsp;|<code><drop-user name='...' (database='...')/></code><br/>{{Code|INLINELIMIT}}
|-
| '''PermissionDefault'''|''ADMIN''{{Code|100}}
|-
| '''Summary'''
|Drops Specifies the user with maximum size the specified body of a function may have in order to be inlined. Function inlining can be turned off by setting this value to {{Code|[name]-1}}. If a |} ===TAILCALLS=== {{Mark|Introduced with Version 7.8:}} {| width='100%'|-| width='120' | '''Signature'''|{{Code|[database]TAILCALLS}} is specified, the user is only dropped locally. The [[#Glob Syntax|-| '''Default'''|{{Code|Glob Syntax]] can be used to address more than one database or user.256}}
|-
| '''ErrorsSummary'''|Specifies how many stack frames of [http://en.wikipedia.org/wiki/Tail_call tail-calls] are allowed on the stack at any time. When this limit is reached, tail-call optimization takes place and some call frames are eliminated. The command fails if feature can be turned off by setting the value to {{Code|admin-1}} is specified as user name, if the specified user does not exist or is logged in, or if the optional database could not be opened for modification.
|}
==GRANT=DEFAULTDB=== {{Mark|Introduced with Version 7.8:}} 
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|GRANT [NONE&#x7c;READ&#x7c;WRITE&#x7c;CREATE&#x7c;ADMIN] (ON [database]) TO [user]DEFAULTDB}}
|-
| '''XML&nbsp;SyntaxDefault'''&nbsp;&nbsp;&nbsp;|<code><grant name='...' permission='none&#x7c;read&#x7c;write&#x7c;create&#x7c;admin' (database='...')/></code><br/>{{Code|false}}
|-
| '''PermissionSummary'''|If this option is turned on, paths specified in the {{Code|fn:doc}} and {{Code|fn:collections}} functions will first be resolved against a database that has been opened in the global context outside the query (e.g. by the [[Commands#OPEN|OPEN]] command). If the path does not match any existing resources, it will be resolved as described in the article on [[Databases#Access Resources|accessing database resources]].|} ===CACHEQUERY==={| width=''ADMIN'100%'
|-
| width='120' | '''SummarySignature'''|Grants the specified [[User_Management|permission]] to the specified {{Code|CACHEQUERY [userboolean]}}. If a {{Code|[database]}} is specified, the permissions are only granted locally. The [[#Glob Syntax|Glob Syntax]] can be used to address more than one database or user.
|-
| '''ErrorsDefault'''|The command fails if {{Code|adminfalse}} is specified as user name, if the specified user does not exist, or if the optional database could not be opened for modification.
|-
| '''ExamplesSummary'''|* {{Code|GRANT READ TO JoeWinson}}<br/>grants {{Code|READ}} permission Caches the query results before returning them to the user client. This option may be set to {{Code|JoeWinsontrue}}if the whole result is needed for further operations (such as is e.g.* {{Code|GRANT WRITE ON Wiki TO editor*}}<br/>grants {{Code|WRITE}} permissions on the {{Code|Wiki}} database to all users starting with case in the characters {{Code|editor*}}GUI of BaseX).
|}
==PASSWORD=FORCECREATE===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|PASSWORD (FORCECREATE [passwordboolean])}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><password>([password])</password></code><br/>
|-
| '''PermissionDefault'''|''NONE''{{Code|false}}
|-
| '''Summary'''
|Changes By activating this option, the XQuery {{Code|[password]doc()}} of and {{Code|collection()}} functions will create database instances for the current user. The password must be a valid MD5 hash value. If no password is specified in the console mode, it is requested via standard addressed input.|-| '''Errors'''|The command fails if the password is no valid MD5 hash valuefiles.
|}
=General Commands==CHECKSTRINGS===
==RUN==
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|RUN CHECKSTRINGS [fileboolean]}}
|-
| '''XML&nbsp;SyntaxDefault'''&nbsp;&nbsp;&nbsp;|<code><run file='...'/></code>{{Code|true}}
|-
| '''PermissionSummary'''|''depends on If this option is turned off, strings from external sources will be adopted as is, i. e., without being checked for valid XML characters:* This option affects [[Java Bindings]] and the string conversion and inputfunctions [[Archive Module#archive:create|archive:create]], [[Archive Module#archive:extract-text|archive:extract-text]], [[Archive Module#archive:update|archive:update]], [[Conversion Module#convert:binary-to-string|convert:binary-to-string]], [[Fetch Module#fetch:text|fetch:text]], [[File Module#file:read-text|file:read-text]], and [[ZIP Module#zip:text-entry|zip:text-entry]].* Please be aware that an inconsiderate use of this option may cause unexpected behavior when storing or outputting strings.|} ===LSERROR==={| width='100%'
|-
| width='120' | '''SummarySignature'''|Evaluates the contents of {{Code|LSERROR [fileerror]}} as XQuery expression. If the file ends with the suffix {{Code|.bxs}}, the file content will be evaluated as [[#Basics|command script]]. This command can be used to run several commands in a single transaction.
|-
| '''ErrorsDefault'''|The command fails if the specified file does not exist, or if the retrieved input is invalid. It will be canceled as soon as one of the executed commands fails.{{Code|0}}
|-
| '''ExamplesSummary'''|* <code>RUN queryThis option specifies the maximum Levenshtein error for the BaseX-specific fuzzy match option.xq</code><br/>will evaluated See the specified file as XQuery expression* <code>RUN commandspage on [[Full-Text#Fuzzy_Querying|Full-Texts]] for more information on fuzzy querying.bxs</code><br/>will evaluated the specified file as command script
|}
==EXECUTE=RUNQUERY=== {{Mark|Introduced with Version 7.8:}}
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|EXECUTE RUNQUERY [inputboolean]}}|-| '''Default'''|{{Code|true}}|-| '''Summary'''|Specifies if a query will be executed or parsed only. This option can also be changed on [[Command-Line Options#BaseX Standalone|command line]] via <code>-R</code>.|} ===RUNS==={| width='100%'
|-
| width='120' | '''XML&nbsp;SyntaxSignature'''&nbsp;&nbsp;&nbsp;|<code><execute>{{Code|RUNS [inputnum]</execute></code>}}
|-
| '''PermissionDefault'''|''depends on input''{{Code|1}}
|-
| '''Summary'''
|Evaluates Specifies how often a query will be evaluated. The result is serialized only once, and the specified measured times are averages of all runs. This option can also be changed on [[Command-Line Options#BaseX Standalone|command line]] via <code>-r</code>.|} =Serialization Options= ===SERIALIZE==={| width='100%'|-| width='120' | '''Signature'''|{{Code|SERIALIZE [inputboolean]}} as [[#Basics|command script]]. This command can be used to run several commands in a single transaction.
|-
| '''ErrorsDefault'''|The command fails if the syntax of the specified input is invalid. It will be canceled as soon as one of the executed commands fails.{{Code|true}}
|-
| '''ExamplesSummary'''|* <code>EXECUTE "create db db1; create db db2"</code><br/>* Results of XQuery expressions will be serialized if this option is turned on. For debugging purposes and performance measurements, this option can be set to {{Code|false}}. It can also be turned off on [[Command-Line Options#BaseX Standalone|command line]] via <code>EXECUTE "<commands><create-db name='db1'/><create-db name='db2'/></commands>"z</code><br/>both commands will create two databases {{Code|db1}} and {{Code|db2}} in a single transaction.
|}
==GET=SERIALIZER===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|GET SERIALIZER [optionparams]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><get option='...'/></code><br/>
|-
| '''PermissionDefault'''|''NONEempty''
|-
| '''Summary'''
|Returns the current value of the Contains parameters for [[OptionsSerialization|Optionserializing]] specified via {{Code|[query results:* Keys and values are separated by equality signs.* Multiple parameters are delimited by commas.* The option]}}. Global options can only also be requested by users used on [[Command-Line Options#BaseX Standalone|command line]] with ADMIN permissionsthe flag <code>-s</code>.
|-
| '''ErrorsExample'''|The command fails if <code>encoding=US-ASCII,omit-xml-declaration=no</code> : sets the specified option is unknownencoding to {{Code|US-ASCII}} and prints the XML declaration.
|}
==SET=EXPORTER===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|SET EXPORTER [optionparams] (}}|-| '''Default'''|''empty''|-| '''Summary'''|Contains parameters for exporting all resources of a database; see [value[Serialization])}] for more details. Keys and values are separated by equality signs, multiple parameters are delimited by commas.|===XMLPLAN==={| width='100%'
|-
| width='120' | '''XML&nbsp;SyntaxSignature'''&nbsp;&nbsp;&nbsp;|<code><set option='...'>({{Code|XMLPLAN [valueboolean])</set></code><br/>}}
|-
| '''PermissionDefault'''|''NONE''{{Code|false}}
|-
| '''Summary'''
|Sets Prints the execution plan of an XQuery expression in its XML representation. This option can also be activated on [[Command-Line Options#BaseX Standalone|Optioncommand line]] specified by via <code>-x</code>. |} ===COMPPLAN==={| width='100%'|-| width='120' | '''Signature'''|{{Code|COMPPLAN [optionboolean]}} to a new |-| '''Default'''|{{Code|[value]true}}. Only local options can be modified. If no value is specified, and if the value is boolean, it will be inverted.
|-
| '''ErrorsSummary'''|The command fails if Creates the specified option is unknown query plan before or if the specified value is invalidafter query compilation. Query plans might change due to optimizations.
|}
==INFO=DOTPLAN===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|INFODOTPLAN [boolean]}}|-| '''Default'''|{{Code|false}}|-| '''Summary'''|Visualizes the execution plan of an XQuery expression with [http://www.graphviz.org dotty] and saves its dot file in the query directory.|} ===DOTCOMPACT==={| width='100%'
|-
| width='120' | '''XML&nbsp;SyntaxSignature'''&nbsp;&nbsp;&nbsp;|<code><info/></code><br/>{{Code|DOTCOMPACT [boolean]}}
|-
| '''PermissionDefault'''|''READ''{{Code|false}}
|-
| '''Summary'''
|Shows global informationChooses a compact dot representation.
|}
=Other Options= ===AUTOFLUSH=HELP==
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|HELP AUTOFLUSH [boolean]}}|-| '''Default'''|{{Code|true}}|-| '''Summary'''|Flushes database buffers to disk after each update. If this option is set to {{Code|false}}, bulk operations (multiple single updates) will be evaluated faster. As a drawback, the chance of data loss increases if the database is not explicitly flushed via the [[Commands#FLUSH|FLUSH]] command]).|} ===WRITEBACK=== {{Mark|Updated with Version 7.8:}}only applies to main-memory document instances. {| width='100%'
|-
| width='120' | '''XML&nbsp;SyntaxSignature'''&nbsp;&nbsp;&nbsp;|<code><help>({{Code|WRITEBACK [commandboolean])</help></code><br/>}}
|-
| '''PermissionDefault'''|''NONE''{{Code|false}}
|-
| '''Summary'''
|If Propagates updates on main-memory instances of files that have been retrieved via {{Code|[command]fn:doc}} or {{Code|fn:collection}} back to disk. No backups of your original files will be created if this option is specified, information turned on the specific command is printed; otherwise, all commands are listed.|This option can also be activated on [[Command-Line Options#BaseX Standalone| '''Errors'''|The command fails if the specified command is unknownline]] via <code>-u</code>.
|}
==EXIT=MAXSTAT===
{| width='100%'
|-
|width='130120'|'''SyntaxSignature'''|{{Code|EXIT MAXSTAT [num]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><exit/></code><br/>
|-
| '''PermissionDefault'''|''NONE''{{Code|30}}
|-
| '''Summary'''
|Exits Specifies the console modemaximum number of index occurrences printed by the <code>[[Commands#INFO|INFO INDEX]]</code> command.
|}
=Changelog=
 
;Version 7.8
 
* Added: <code>[[#CSVPARSER|CSVPARSER]]</code>, <code>[[#JSONPARSER|JSONPARSER]]</code>, <code>[[#TEXTPARSER|TEXTPARSER]]</code>, <code>[[#HTMLPARSER|HTMLPARSER]]</code>, <code>[[#INLINELIMIT|INLINELIMIT]]</code>, <code>[[#TAILCALLS|TAILCALLS]]</code>, <code>[[#DEFAULTDB|DEFAULTDB]]</code>, <code>[[#RUNQUERY|RUNQUERY]]</code>
* Updated: <code>[[#WRITEBACK|WRITEBACK]]</code> only applies to main-memory document instances.
* Updated: <code>[[#DEBUG|DEBUG]]</code> option can be changed at runtime by users with admin permissions.
* Updated: default of <code>[[#INTPARSE|INTPARSE]]</code> is now {{Code|false}}.
* Removed: <code>HTMLOPT</code> (replaced with <code>[[#HTMLPARSER|HTMLPARSER]]</code>), <code>PARSEROPT</code> (replaced with parser-specific options), <code>DOTDISPLAY</code>, <code>DOTTY</code>
;Version 7.7
* UpdatedAdded: syntax of <code>[[#Valid NamesADDCACHE|valid namesADDCACHE]]</code>, <code>[[#CHECKSTRINGS|CHECKSTRINGS]]</code>, <code>[[#FTINDEXSPLITSIZE|FTINDEXSPLITSIZE]]</code>, <code>[[#INDEXSPLITSIZE|INDEXSPLITSIZE]]</code> ;Version 7.6 * Added: <code>[[#GLOBALLOCK|GLOBALLOCK]]</code>* Added: store local options in configuration file after {{Code|# Local Options}} comments.
;Version 7.5
* Added: options can now be set via system properties* Added: a pragma expression can be used to locally change database options* Added: <code>[[#EXECUTEUSER|EXECUTEUSER]]</code> executes a command script* Added: , <code>[[#PASSWORD|PASSWORD]]</code>, <code>[[#LOG|LOG]]</code>, <code>[[#LOGMSGMAXLEN|LOGMSGMAXLEN]]</code>, <code>[[#INSPECTWEBPATH|INSPECTWEBPATH]]</code> performs integrity checks* Added: automatic detection of , <code>[[#BasicsRESTXQPATH|Command ScriptsRESTXQPATH]]* Removed: {{Code</code><code>[[#HTTPLOCAL|SHOW DATABASES}}; information is also returned by HTTPLOCAL]]</code>, <code>[[#SHOW SESSIONSCREATEONLY|SHOW SESSIONSCREATEONLY]]</code>* Removed: , <code>[[#OPENSTRIPNS|OPENSTRIPNS]]</code>* Removed: {{Code|HTTPPATH}}; {{Code|HTTPPORT}}: path argument{{Code|jetty.xml}} configuration file is used instead* Removed: global options cannot be changed anymore during the lifetime of a BaseX instance
;Version 7.3
* Added: [[#XML Syntax|XML Syntax]] added* Updated: <code>[[#CHECKKEEPALIVE|CHECKKEEPALIVE]]</code> can now be used to create empty databases* Updated: Names and paths in , <code>[[#OPENTIMEOUT|OPENTIMEOUT]]</code> and <code>[[#LIST|LIST]]</code> are now specified as separate arguments ;Version 7.2.1: default values changed* UpdatedRemoved: permissions for <code>[[#GET|GET]]</code> and <code>[[#SET|SET]]</code> changed from {{Code|READWILDCARDS}} to ; new index supports both fuzzy and wildcard queries* Removed: {{Code|NONESCORING}}; new scoring model will focus on lengths of text nodes and match options
;Version 7.2
* UpdatedAdded: <code>[[#CREATE INDEXPROXYHOST|CREATE INDEXPROXYHOST]]</code>, <code>[[#DROP INDEXPROXYPORT|DROP INDEXPROXYPORT]]</code> ({{Code|PATH}} argument removed. Path summary is always available now and updated with [[#OPTIMIZE|OPTIMIZE]])* Updated: permissions for , <code>[[#REPO DELETENONPROXYHOSTS|REPO DELETENONPROXYHOSTS]]</code>, <code>[[#REPO INSTALLHTMLOPT|REPO INSTALLHTMLOPT]]</code> and * Updated: <code>[[#REPO LISTTIMEOUT|REPO LISTTIMEOUT]]</code>: ignore timeout for admin users
;Version 7.1
* Added: <code>[[#ADDRAW|ADDRAW]]</code>, <code>[[#MAXLEN|MAXLEN]]</code>, <code>[[#MAXCATS|MAXCATS]]</code>, <code>[[#UPDINDEX|UPDINDEX]]</code>* Updated: <code>[[#KILLBINDINGS|KILLBINDINGS]]</code> (killing sessions by specifying IP:port)
;Version 7.0
* Added: <code>[[#FLUSHSERVERHOST|FLUSHSERVERHOST]]</code>, <code>[[#RETRIEVEKEEPALIVE|RETRIEVEKEEPALIVE]]</code>, <code>[[#STOREAUTOFLUSH|STOREAUTOFLUSH]]</code>* Updated: , <code>[[#ADDQUERYPATH|ADDQUERYPATH]]</code>: simplified arguments [[Category:Beginner]][[Category:Server]]
administrator, Bureaucrats, editor, reviewer, Administrators
57

edits

Navigation menu