Changes

Jump to navigation Jump to search
6,008 bytes added ,  11:24, 28 July 2022
m
Text replacement - "[[Jobs Module" to "[[Job Module"
In BaseX, two internal representations exist for nodes.
* XML fragments are generated by XQuery node constructors.db:b
* Database nodes are:
** stored in a persistent database on disk;
return ft:mark($p[text() contains text 'word'], 'b')
</syntaxhighlight>
 
==Updating Functions==
 
Various functions in this module are ''updating''. Updating functions will not be immediately executed, but queued on the [[XQuery Update#Pending Update List|Pending Update List]], and processed after the remaining query has been evaluated. This means that the order in which the functions are specified in the query often does not reflect the order in which they will eventually be executed.
=General Functions=
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:system||element(system)}}
|-valign="top"
| '''Summary'''
|Returns general information on the database system the current values of all global and local [[Options]]. The {{Command|INFO}} command returns similar output.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:option|$name as xs:string|xs:string}}
|-valign="top"
| '''Summary'''
|Returns the current value (string, integer, boolean, map) of a global or local [[Options|Option]] with the specified {{Code|$name}}. The {{Command|GETSHOW OPTIONS}} command works returns similaroutput.|-valign="top"
| '''Errors'''
|{{Error|option|#Errors}} the specified option is unknown.
|-valign="top"
| '''Examples'''
|
* <code>db:option('dbpath')</code> returns the database path string.
* <code>db:option('serializer')</code> returns a map with the current serialization parameters.
* <code>declare option db:chop stripws 'true'; db:option('chopstripws')</code> returns {{Code|true}} (irrespective of the global locally assigned value).
|}
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:info|$db as xs:string|element(database)}}
|-valign="top"
| '''Summary'''
|Returns meta information on the database {{Code|$db}}. The output is similar to the {{Command|INFO DB}} command.
|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:property|$db as xs:string, $name as xs:string|xs:anyAtomicType}}
|-valign="top"
| '''Summary'''
|Returns the value (string, boolean, integer) of a property with the specified {{Code|$name}} in the database {{Code|$db}}. The available properties are the ones returned by [[#db:info{{Function||db:info]]}}.|-valign="top"
| '''Errors'''
|{{Error|property|#Errors}} the specified property is unknown.
|-valign="top"
| '''Examples'''
|
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:list||xs:string*}}<br/>{{Func|db:list|$db as xs:string|xs:string*}}<br/>{{Func|db:list|$db as xs:string, $path as xs:string|xs:string*}}
|-valign="top"
| '''Summary'''
|The result of this function is dependent on the number of arguments:
* If a database {{Code|$db}} is specified, all documents and raw files of the specified database are returned.
* The list of returned resources can be restricted by the {{Code|$path}} argument.
|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.
|-valign="top"
| '''Examples'''
|
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:list-details||element(database)*}}<br/>{{Func|db:list-details|$db as xs:string|element(resource)*}}<br/>{{Func|db:list-details|$db as xs:string, $path as xs:string|element(resource)*}}
|-valign="top"
| '''Summary'''
|Without arguments, an element is returned for each database that is accessible to the current user:
* The value of the size attribute depends on the resource type: for documents, it represents the number of nodes; for binary data, it represents the file size (measured in bytes).
* Returned databases resources can be further restricted by the {{Code|$path}} argument.
|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.
|-valign="top"
| '''Examples'''
|
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:dir|$db as xs:string, $path as xs:string|element()*}}
|-valign="top"
| '''Summary'''
|Returns meta data metadata on all directories and resources of the database {{Code|$db}} in the specified directory {{Code|$path}}. Two types of elements are returned:
* {{Code|resource}} represents a resource. The element value is the directory path; content type, modification date, raw flag (which indicates if the resource is binary or XML), and size of the resource are returned as attributes.
* {{Code|dir}} represents a directory. The element value is the directory path; the modification date is returned as attribute.
Please note that directories are not stored in BaseX. Instead, they result implicitly from the paths of stored resources.
|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|path|#Errors}} the specified path is invalid.
|-valign="top"
| '''Examples'''
|
|}
=Read Operations= ==db:backupsget==
{{MarkAnnounce|Updated with Version 9.810:}} Renamed (before: {{Code|db:open}} Support ). Due to its widespread use, the old function name will be supported for commentssome more time.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:backupsget|$db as xs:string|elementdocument-node(backup)*}}<br/>{{Func|db:backupsget|$db as xs:string, $path as xs:string|elementdocument-node(backup)*}}|-valign="top"
| '''Summary'''
|Returns an element sequence containing all available database backups.<br/>If a documents from the database {{Code|$db}} is specified, or only documents matching the sequence will be restricted to specified {{Code|$path}}.|- valign="top"| '''Errors'''|{{Error|open|#Errors}} the backups matching this addressed databasedoes not exist or could not be opened.|-valign="top"
| '''Examples'''
|
* {{Code|db:backupsget("factbook"'docs')}} returns all backups that have been made documents from the database named {{Code|factbookdocs}} .* {{Code|db:get('db', 'one')}} returns all documents from the databasenamed {{Code|db}} located in the path {{Code|one}}.* <code>for $i in 1 to 3 return db:get('db' || $i)//item</code> returns all item elements from the databases {{Code|db1}}, {{Code|db2}} and {{Code|db3}}.
|}
=Read Operations=db:get-pre==
=={{Announce|Updated with Version 10:}} Renamed (before: {{Code|db:open==-pre}}).
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:open|$db as xs:string|documentget-node()*}}<br />{{Func|db:openpre|$db as xs:string, $path pres as xs:stringinteger*|document-node()*}}|-valign="top"
| '''Summary'''
|Opens Returns all nodes from the database {{Code|$db}} and returns all with the pre values {{Code|$pres}} in [[Utility Module#util:ddo|distinct document nodesorder]].<br/>The document nodes [[Node Storage#PRE Value|PRE value]] provides very fast access to be returned can be filtered an existing database node, but it will change whenever a node with the {{Code|$path}} argumenta smaller ''pre'' values is added to or deleted from a database.|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|range|#Errors}} the specified pre value does not exist in the database.|-valign="top"
| '''Examples'''
|
* {{Code|db:openget-pre("docs", 0)}} returns all documents from the first database named {{Code|docs}}.* {{Code|db:open("db", "one")}} returns all documents node from the database named {{Code|db}} located in the path {{Code|one}}.* <code>for $i in 1 to 3 return db:open("db" || $i)//item</code> returns all item elements from the databases {{Code|db1}}, {{Code|db2}} and {{Code|db3docs}}.
|}
==db:openget-preid== {{Announce|Updated with Version 10:}} Renamed (before: {{Code|open-id}}).
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:openget-preid|$db as xs:string, $pres ids as xs:integer*|node()*}}|-valign="top"
| '''Summary'''
|Opens Returns all nodes from the database {{Code|$db}} and returns all distinct nodes with the pre values {{Code|$presids}} in [[Utility Module#util:ddo|distinct document order]].<br/>The Each database node has a ''persistent'' [[Node Storage#PRE ID Value|PRE ID value]] provides very fast access . Access to an existing database the node, but it will change whenever a node with a smaller ''pre'' values is added to or deleted from a databaseID can be sped up by turning on the {{Option|UPDINDEX}} option.|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|range|#Errors}} the specified pre ID value does not exist in the database.|} ==db:get-binary== {{Announce|Updated with Version 10}}: renamed (before: {{Code|db:retrieve}}). {| width='100%'|- valign="top"| width='120' | '''Signatures'''|{{Func|db:get-binary|$db as xs:string, $path as xs:string|item()}}|- valign="top"| '''Summary'''|Returns a map with all paths and binary resources of the database {{Code|$db}}. A single {{Code|xs:base64Binary}} item is returned if a {{Code|$path}} is specified. All items are [[Lazy Module|lazy]], i.e., the actual data will only be retrieved if it is processed.|- valign="top"| '''Errors'''|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|mainmem|#Errors}} the database is not ''persistent'' (stored on disk).|-valign="top"
| '''Examples'''
|
* {{Code|db:openget-prebinary("docs"'DB', 0'music/01.mp3')}} returns the first database node from specified audio file as raw data.* <code><nowiki>stream:materialize(db:get-binary('DB', 'music/01.mp3'))</nowiki></code> materializes the streamable result in main-memory before returning it.* <code><nowiki>convert:binary-to-string(db:get-binary('DB', 'info.txt'), 'UTF-8')</nowiki></code> converts a binary database named {{Code|docs}}resource as UTF-8 text and returns a string.
|}
==db:openget-idvalue== {{Announce|Introduced with Version 10.}}
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:openget-idvalue|$db as xs:string, $ids path as xs:integer*string|nodeitem()*}}|-valign="top"
| '''Summary'''
|Opens Returns a map with all paths and values of the database {{Code|$db}} and returns all distinct nodes with the specified . A single value is returned if a {{Code|$idspath}} in document order.<br />Each database node has a ''persistent'' [[Node Storage#ID Value|ID value]]. Access to the node id can be sped up by turning on the {{Option|UPDINDEX}} optionis specified.|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|rangemainmem|#Errors}} the specified id database is not ''persistent'' (stored on disk).|- valign="top"| '''Examples'''|* {{Code|db:get-value does not exist in ('DB', 'sequence')}} returns the databasespecified sequence.
|}
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:node-pre|$nodes as node()*|xs:integer*}}
|-valign="top"
| '''Summary'''
|Returns the ''pre'' values of the specified {{Code|$nodes}}, which must all be [[#Database Nodes|database nodes]].<br/>The [[Node Storage#PRE Value|PRE value]] provides very fast access to an existing database node, but it will change whenever a node with a smaller ''pre'' values is added to or deleted from a database.
|-valign="top"
| '''Errors'''
|{{Error|node|#Errors}} {{Code|$nodes}} contains a node which is not stored in a database.
|-valign="top"
| '''Examples'''
|
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:node-id|$nodes as node()*|xs:integer*}}
|-valign="top"
| '''Summary'''
|Returns the ''id'' values of the specified {{Code|$nodes}}, which must all be [[#Database Nodes|database nodes]].<br/>Each database node has a ''persistent'' [[Node Storage#ID Value|ID value]]. Access to the node id can be sped up by turning on the {{Option|UPDINDEX}} option.
|-valign="top"
| '''Errors'''
|{{Error|node|#Errors}} {{Code|$nodes}} contains a node which is not stored in a database.
|}
 
==db:retrieve==
 
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|db:retrieve|$db as xs:string, $path as xs:string|xs:base64Binary}}
|-
| '''Summary'''
|Returns a [[Binary Data|binary resource]] addressed by the database {{Code|$db}} and {{Code|$path}} as [[Streaming Module|streamable]] {{Code|xs:base64Binary}}.
|-
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|mainmem|#Errors}} the database is not ''persistent'' (stored on disk).
|-
| '''Examples'''
|
* {{Code|db:retrieve("DB", "music/01.mp3")}} returns the specified audio file as raw data.
* <code><nowiki>stream:materialize(db:retrieve("DB", "music/01.mp3"))</nowiki></code> materializes the streamable result in main-memory before returning it.
* <code><nowiki>convert:binary-to-string(db:retrieve("DB", "info.txt"), 'UTF-8')</nowiki></code> converts a binary database resource as UTF-8 text and returns a string.
|}
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:export|$db as xs:string, $path as xs:string|empty-sequence()}}<br />{{Func|db:export|$db as xs:string, $path as xs:string, $params as item()|empty-sequence()}}<br />
|-valign="top"
| '''Summary'''
|Exports the specified database {{Code|$db}} to the specified file {{Code|$path}}. Existing files will be overwritten.<br />The {{Code|$params}} argument contains [[Serialization|serialization parameters]]. As with [https://www.w3.org/TR/xpath-functions-31/#func-serialize fn:serialize()], the parameters can be specified<br />
map { "method": "xml", "cdata-section-elements": "div", ... }
</syntaxhighlight>
|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.
|-valign="top"
| '''Examples'''
| Export all files as text:<br/>
db:export("DB", "/home/john/xml/texts", map { 'method': 'text' })
</syntaxhighlight>
The following query code can be used to export parts of the database:
<syntaxhighlight lang="xquery">
let $target := '/home/john/xml/target'
for $doc in db:openget('DB', 'collection')
let $path := $target || db:path($doc)
return (
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:text|$db as xs:string, $strings as xs:string*|text()*}}
|-valign="top"
| '''Summary'''
|Returns all text nodes of the database {{Code|$db}} that have one of the specified {{Code|$strings}} as values and that are stored in the text index.
|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|no-index|#Errors}} the index is not available.<br/>
|-valign="top"
| '''Examples'''
|
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:text-range|$db as xs:string, $min as xs:string, $max as xs:string|text()*}}
|-valign="top"
| '''Summary'''
|Returns all text nodes of the database {{Code|$db}} whose values are between {{Code|$min}} and {{Code|$max}} and that are stored in the text index.
|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|no-index|#Errors}} the index is not available.<br/>
|-valign="top"
| '''Examples'''
|
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:attribute|$db as xs:string, $strings as xs:string*|attribute()*}}<br/>{{Func|db:attribute|$db as xs:string, $strings as xs:string*, $name as xs:string|attribute()*}}
|-valign="top"
| '''Summary'''
|Returns all attribute nodes of the database {{Code|$db}} that have one of the specified {{Code|$strings}} as values and that are stored in the attribute index.<br />If {{Code|$name}} is specified, the resulting attribute nodes are filtered by their attribute name.
|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|no-index|#Errors}} the index is not available.<br/>
|-valign="top"
| '''Examples'''
|
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:attribute-range|$db as xs:string, $min as xs:string, $max as xs:string|attribute()*}}<br/>{{Func|db:attribute-range|$db as xs:string, $min as xs:string, $max as xs:string, $name as xs:string|attribute()*}}
|-valign="top"
| '''Summary'''
|Returns all attributes of the database {{Code|$db}}, the string values of which are larger than or equal to {{Code|$min}} and smaller than or equal to {{Code|$max}} and that are stored in the attribute index.
|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|no-index|#Errors}} the index is not available.<br/>
|-valign="top"
| '''Examples'''
|
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:token|$db as xs:string, $tokens as xs:string*|attribute()*}}<br/>{{Func|db:token|$db as xs:string, $tokens as xs:string*, $name as xs:string|attribute()*}}
|-valign="top"
| '''Summary'''
|Returns all attribute nodes of the database {{Code|$db}} the values of which contain one of the specified {{Code|$tokens}}.<br />If {{Code|$name}} is specified, the resulting attribute nodes are filtered by their attribute name.
|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|no-index|#Errors}} the index is not available.<br/>
|-valign="top"
| '''Examples'''
|
=Updates=
'''Important note:''' All functions in this section are ''updating functions'': they will not be immediately executed, but queued on the [[XQuery Update#Pending Update ListUpdating Functions|Pending Update ListUpdating Functions]], which will be processed after the actual query has been evaluated. This means that the order in which the functions are specified in the query does usually not reflect the order in which the code will be evaluated.
==db:create==
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:create|$db as xs:string|empty-sequence()}}<br/>{{Func|db:create|$db as xs:string, $inputs as item()*|empty-sequence()}}<br/>{{Func|db:create|$db as xs:string, $inputs as item()*, $paths as xs:string*|empty-sequence()}}<br/>{{Func|db:create|$db as xs:string, $inputs as item()*, $paths as xs:string*, $options as map(*)?|empty-sequence()}}
|-valign="top"
| '''Summary'''
|Creates a new database with name {{Code|$db}} and adds initial documents specified via {{Code|$inputs}} to the specified {{Code|$paths}}:
* An existing database will be overwritten.
* Database creation takes place after most other update operations (see [[XQuery Update#Pending Update List|Pending Update List]]). As a consequence, a newly created database cannot be addressed in the same query.
|-valign="top"
| '''Errors'''
|{{Error|lock|#Errors}} a database is opened by another process.<br/>{{Error|name|#Errors}} the specified name is not a [[Commands#Valid_Names|valid database name]].<br/>{{Error|conflict|#Errors}} the same database was addressed more than once.<br/>{{Error|args|#Errors}} the number of specified inputs and paths differs.
|-valign="top"
| '''Examples'''
|
|}
==db:dropadd==
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:dropadd|$db as xs:string, $input as item()|empty-sequence()}}<br/>{{Func|db:add|$db as xs:string, $input as item(), $path as xs:string?|empty-sequence()}}<br/>{{Func|db:add|$db as xs:string, $input as item(), $path as xs:string?, $options as map(*)?|empty-sequence()|empty-sequence()}}|-valign="top"
| '''Summary'''
|Drops Adds documents specified by {{Code|$input}} to the database {{Code|$db}} with the specified {{Code|$path}}:* A document with the same path may occur more than once in a database. If you want to enforce single instances, use {{Function||db:put}} instead.* See {{Function||db:create}} for more details on the input and path arguments.* The parsing behavior can be controlled via {{Code|$options}}:** allowed options are {{Option|ADDCACHE}} and the [[Options#Parsing|parsing]] and [[Options#XML Parsing|XML parsing]] options, all connected resources.in lower case** parsing options will only impact string input (URIs, XML strings), because nodes have already been parsed|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|lock|#Errors}} a database is opened by another process.<br/>{{Error|conflict|#Errors}} the same database was addressed more than once.|-valign="top"
| '''Examples'''
|
* <code>db:add("DB", "/home/dir/doc.xml")</code> adds the file {{Code|/home/dir/doc.xml}} to the database {{Code|DB}}.* <code>db:dropadd("DB", <a/>, "doc.xml")</code> adds a document node to the database {{Code|DB}} drops under the name {{Code|doc.xml}}.* <code>db:add("DB", "/home/dir", "docs/dir", map { 'addcache': true() })</code> adds all documents in {{Code|/home/dir}} to the database {{Code|DB}}under the path {{Code|docs/dir}}. In order to reduce memory consumption, the files will be cached before being added to the database.
|}
==db:addput== {{Announce|Updated with Version 10}}: renamed (before: {{Code|db:replace}}); function signature aligned with {{Function||db:add}} (second and third argument swapped).
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:add|$db as xs:string, $input as item()|empty-sequence()}}<br/>{{Func|db:addput|$db as xs:string, $input as item(), $path as xs:string?|empty-sequence()}}<br/>{{Func|db:addput|$db as xs:string, $input as item(), $path as xs:string?, $options as map(*)?|empty-sequence()|empty-sequence()}}|-valign="top"
| '''Summary'''
|Adds documents Replaces a resource, specified by {{Code|$inputpath}} to , in the database {{Code|$db}} with the specified contents of {{Code|$pathinput}}:* A document with the same path may occur more than once in , or adds it as a database. If you want to enforce single instances, use [[#db:replace|db:replace]] instead.* See [[#db:create|dbnew resource:create]] for more details on the input and path arguments.
* The parsing behavior can be controlled via {{Code|$options}}:
** allowed Allowed options are {{Option|ADDCACHE}} and the [[Options#Parsing|parsing]] and [[Options#XML Parsing|XML parsing]] options, all in lower case.** parsing Parsing options will only impact string input (URIs, XML strings), because nodes have already been parsed.* See {{Function||db:create}} for more details on the input argument.|- valign="top"| '''Errors'''|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|target|#Errors}} the path points to a directory.|- valign="top"| '''Examples'''|* {{Code|db:put("DB", "/home/dir/doc.xml", "docs/dir/doc.xml")}} replaces the content of the document {{Code|docs/dir/doc.xml}} in the database {{Code|DB}} with the content of the file {{Code|/home/dir/doc.xml}}.* {{Code|db:put("DB", "<a/>", "docs/dir/doc.xml")}} replaces the content of the document {{Code|docs/dir/doc.xml}} in the database {{Code|DB}} with {{Code|&lt;a/&gt;}}.* {{Code|db:put("DB", document { <a/> }, "docs/dir/doc.xml")}} replaces the content of the document {{Code|docs/dir/doc.xml}} in the database {{Code|DB}} with the specified document node.The following query can be used to import files from a directory to a database:<syntaxhighlight lang="xquery">let $source := '/home/john/xml/source'for $file in file:list($source, true())let $path := $source || $filewhere not(file:is-dir($path))return db:put('db', doc($path), $file)</syntaxhighlight>|} ==db:put-binary== {{Announce|Updated with Version 10}}: renamed (before: {{Code|db:put}}); function signature aligned with {{Function||db:add}} (second and third argument swapped). {| width='100%'|- valign="top"| width='120' | '''Signatures'''|{{Func|db:put-binary|$db as xs:string, $input as item(), $path as xs:string|empty-sequence()}}|- valign="top"| '''Summary'''|Stores a binary resource specified by {{Code|$input}} in the database {{Code|$db}} at the specified {{Code|$path}}. Existing resources are overwritten.|- valign="top"| '''Errors'''|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|mainmem|#Errors}} the database is not ''persistent'' (stored on disk).|- valign="top"| '''Examples'''|* {{Code|db:put-binary('DB', file:read-binary('video.mov'), 'video/sample.mov')}} stores the addressed video file at the specified location.* With the following query, you can copy the binary resources of one database into another:<syntaxhighlight lang="xquery">let $db := 'db'let $src-path := 'src/'let $trg-path := 'trg/'for $src in db:list($db, $src-path)where db:type($db, $src) = 'binary'let $trg := $trg-path || substring-after($src, $src-path)return db:put-binary($db, db:get-binary($db, $src), $trg)</syntaxhighlight>|} ==db:put-value== {{Announce|Introduced with Version 10.}} {| width='100%'|- valign="top"| width='120' | '''Signatures'''|{{Func|db:put-value|$db as xs:string, $input as item()*, $path as xs:string|empty-sequence()}}|- valign="top"| '''Summary'''|Stores a value specified by {{Code|$input}} in the database {{Code|$db}} at the specified {{Code|$path}}. Existing resources are overwritten. The value can be an arbitrary sequence of atomic items, nodes, maps, and arrays.|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|mainmem|#Errors}} the database is not ''persistent'' (stored on disk).|-valign="top"
| '''Examples'''
|
* <code>{{Code|db:addput-value("'DB"', 1 to 10000, "/home/dir/doc.xml"'sequence')</code> adds the file {{Code|/home/dir/doc.xml}} to stores a numeric range in the database {{Code|DB}}.* <code>db:add("DB"With the following query, <a/>, "doc.xml")</code> adds map with countries and associated cities is stored in a document node to the database {{Code|DB}} under the name {{Code|doc.xml}}The value resource can e.g.be used as index in future queries:* <codesyntaxhighlight lang="xquery">db:addput-value("DB" 'factbook', " map:merge( for $country in db:get('factbook')/home/dir"country return map:entry($country/@name, "docs$country//city/dir"name ! string()) ), map { 'addcachecities': true() })</codesyntaxhighlight> adds all documents in {{Code|/home/dir}} to the database {{Code|DB}} under the path {{Code|docs/dir}}. In order to reduce memory consumption, the files will be cached before being added to the database.
|}
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:delete|$db as xs:string, $path as xs:string|empty-sequence()}}
|-valign="top"
| '''Summary'''
|Deletes resource(s), specified by {{Code|$path}}, from the database {{Code|$db}}.
|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|path|#Errors}} the specified path is invalid.
|-valign="top"
| '''Examples'''
|
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:copy|$db as xs:string, $name as xs:string|empty-sequence()}}
|-valign="top"
| '''Summary'''
|Creates a copy of the database {{Code|$db}}, which will be called {{Code|$name}}.
|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|lock|#Errors}} a database is opened by another process.<br/>{{Error|name|#Errors}} invalid database name.<br/>{{Error|conflict|#Errors}} the same database was addressed more than once.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:alter|$db as xs:string, $name as xs:string|empty-sequence()}}
|-valign="top"
| '''Summary'''
|Renames the database {{Code|$db}} to {{Code|$name}}.
|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|lock|#Errors}} a database is opened by another process.<br/>{{Error|name|#Errors}} invalid database name.<br/>{{Error|conflict|#Errors}} the same database was addressed more than once.
|}
==db:create-backupoptimize== {{Mark|Updated with Version 9.8:}} Support for comments.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:createoptimize|$db as xs:string|empty-backupsequence()}}<br/>{{Func|db:optimize|$db as xs:string, $all as xs:boolean|empty-sequence()}}<br/>{{Func|db:optimize|$db as xs:string, $all as xs:boolean, $options as map(*)?|empty-sequence()}}|-valign="top"
| '''Summary'''
|Creates a backup Optimizes the metadata and indexes of the database {{Code|$db}}.<br/>If {{Code|$all}} is {{Code|true}}, the complete database will be rebuilt.<br/>The {{Code|$options}} argument can be used to control indexing. The syntax is identical to the {{Function||db:create}} function: Allowed options are all [[Options#Indexing|indexing]] and [[Options#Full-Text|full-text]] options. {{Option|UPDINDEX}} is only supported if {{Code|$all}} is {{Code|true}}.|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|name|#Errors}} invalid database name.<br/>{{Error|conflict|#Errors}} the same database was addressed more than once.|-valign="top"
| '''Examples'''
|
* {{Code|db:create-backupoptimize("DB")}} creates a backup optimizes the database structures of the database {{Code|DB}}.* <code>db:optimize("DB", true(), map { 'ftindex': true() })</code> optimizes all database structures of the database {{Code|DB}}and creates a full-text index.
|}
==db:drop-backuprename==
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:drop-backuprename|$name db as xs:string, $source as xs:string, $target as xs:string|empty-sequence()}}|-valign="top"
| '''Summary'''
|Drops Moves all backups resources(s) of the database with {{Code|$db}}, which are found in the specified supplied {{Code|$namesource}}. If path, to the given supplied {{Code|$nametarget}} points path. The paths may point to single resources or directories. No updates will take place if a specific backup file, only this specific backup file non-existing source path is deletedsupplied.|-valign="top"
| '''Errors'''
|{{Error|backupopen|#Errors}} No backup file found.<br/>{{Error|name|#Errors}} invalid the addressed database namedoes not exist or could not be opened.<br/>{{Error|conflictpath|#Errors}} the same database was addressed more than oncespecified source or target path, or one of its descendants, is invalid.|-valign="top"
| '''Examples'''
|
* {{Code|db:drop-backuprename("DB", "docs/dir/doc.xml", "docs/dir/newdoc.xml")}} drops all backups of renames the resource {{Code|docs/dir/doc.xml}} to {{Code|docs/dir/newdoc.xml}} in the database {{Code|DB}}.* {{Code|db:drop-backuprename("DB-2014-03-13-17-36-44", "docs/dir", "docs/newdir")}} drops moves all resources in the specific backup file database {{Code|DB-2014-03-13-17-36-44.zip}} of the database from {{Code|DBdocs/dir}} to {Code|docs/newdir}}.
|}
==db:alter-backupflush==
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:alter-backupflush|$name as xs:string, $new-name db as xs:string|empty-sequence()}}|-valign="top"
| '''Summary'''
|Renames all backups Explicitly flushes the buffers of the database with the specified {{Code|$namedb}} to . This command is only useful if {{CodeOption|$new-nameAUTOFLUSH}}. The directory inside the archive will be renamed as well. If the given has been set to {{Code|$namefalse}} points to a specific backup file, only this specific backup file will be renamed.|-valign="top"
| '''Errors'''
|{{Error|backup|#Errors}} No backup file found.<br/>{{Error|name|#Errors}} invalid database name.<br/>{{Error|conflictopen|#Errors}} the same database was addressed more than once.|-| '''Examples'''|* {{Code|db:alter-backup("DB", "DB2)}} renames all backups of the database {{Code|DB}} to {{Code|DB2}}does not exist or could not be opened.
|}
==db:restoredrop==
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:restoredrop|$name db as xs:string|empty-sequence()}}|-valign="top"
| '''Summary'''
|Restores Drops the database with the specified {{Code|$namedb}}. The {{Code|$name}} may include the timestamp of the backup fileand all connected resources.|-valign="top"
| '''Errors'''
|{{Error|lockopen|#Errors}} a the addressed database is does not exist or could not be opened by another process.<br/>{{Error|namelock|#Errors}} invalid a database name.<br/>{{Error|no-backup|#Errors}} No backup foundis opened by another process.<br/>{{Error|conflict|#Errors}} the same database was addressed more than once.|-valign="top"
| '''Examples'''
|
* {{Code|db:restoredrop("DB")}} restores drops the database {{Code|DB}}.* {{Code|db:restore("DB-2014-03-13-18-05-45")}} restores the database {{Code|DB}} from the backup file with the given timestamp.
|}
=Backups= {{Announce|Introduced with Version 10:}} Support for general data ([[User Management|registered users]], [[Job Module#Services|scheduled services]] and [[Store Module|key-value stores]]). All functions in this section except for {{Function||db:backups}} are {{Function|Database|Updating Functions}}. ==db:optimizecreate-backup== {{Announce|Updated with Version 10:}} Options argument added.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:optimizecreate-backup|$db as xs:string|empty-sequence()}}<br/>{{Func|db:optimize|$db as xs:string, $all as xs:boolean|emptycreate-sequence()}}<br/>{{Func|db:optimizebackup|$db as xs:string, $all as xs:boolean, $options as map(*)?|empty-sequence()}}|-valign="top"
| '''Summary'''
|Optimizes the meta data and indexes Creates a backup of the database {{Code|$db}}.<br/>If {{Code|$all}} no name is {{Code|true}}supplied, the complete database general data will be rebuiltbacked up.<br/>The following {{Code|$options}} argument can be used to control indexing. The syntax is identical to the [[#dbare available:create|db:create]] function: Allowed options are all [[Options#Indexing|indexing]] and [[Options#Full-Text|full-text]] options. {{Option|UPDINDEX}} is only supported if * With {{Code|$allcomment}} is , a comment string can be attached to the backup.* By setting {{Code|truecompress}}to false, the backup will be created faster, but it will take more space on disk.|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|name|#Errors}} invalid database name.<br/>{{Error|conflict|#Errors}} the same database was addressed more than once.|-valign="top"
| '''Examples'''
|
* {{Code|db:optimizecreate-backup("'DB")}} optimizes the database structures of the database {{Code|DB}}.* <code>db:optimize("DB", true()', map { 'ftindexcompress': truefalse() })</code> optimizes all database structures }} creates a backup of the database {{Code|DB}} and creates a full-text indexwithout compressing its entries.
|}
==db:renamedrop-backup==
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:renamedrop-backup|$db as xs:string, $source as xs:string, $target name as xs:string|empty-sequence()}}|-valign="top"
| '''Summary'''
|Moves Drops all resources(s) backups of the database with the specified {{Code|$dbname}}, which are found in . If the supplied {{Code|$source}} pathname ends with a timestamp, to only the supplied {{Code|$target}} path. The paths may point to single resources or directoriesspecified backup file will be deleted. No updates will take place if a non-existing source path If no name is supplied, backups with general data are addressed.|-valign="top"
| '''Errors'''
|{{Error|openbackup|#Errors}} the addressed No backup file found.<br/>{{Error|name|#Errors}} invalid database does not exist or could not be openedname.<br/>{{Error|pathconflict|#Errors}} the specified source or target path, or one of its descendants, is invalidsame database was addressed more than once.|-valign="top"
| '''Examples'''
|
* {{Code|db:renamedrop-backup("DB", "docs/dir/doc.xml", "docs/dir/newdoc.xml")}} renames the resource {{Code|docs/dir/doc.xml}} to {{Code|docs/dir/newdoc.xml}} in drops all backups of the database {{Code|DB}}.* {{Code|db:renamedrop-backup("DB", "docs/dir", "docs/newdir-2014-03-13-17-36-44")}} moves all resources in drops the database specific backup file {{Code|DB-2014-03-13-17-36-44.zip}} from of the database {{Code|docs/dir}} to {Code|docs/newdirDB}}.
|}
==db:replacealter-backup==
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:replacealter-backup|$db name as xs:string, $path as xs:string, $input as item()|emptynew-sequence()}}<br/>{{Func|db:replace|$db name as xs:string, $path as xs:string, $input as item(), $options as map(*)?|empty-sequence()|empty-sequence()}}|-valign="top"
| '''Summary'''
|Replaces a resource, specified by {{Code|$path}}, in Renames all backups of the database {{Code|$db}} with the contents of specified {{Code|$inputname}}, or adds it as a new resource:* See [[#db:create|db:create]] for more details on the input argument.* The parsing behavior can be controlled via to {{Code|$optionsnew-name}}:** allowed options are {{Option|ADDCACHE}} and . If the [[Options#Parsing|parsing]] and [[Options#XML Parsing|XML parsing]] optionsname ends with a date, all in lower case** parsing options will only impact string input (URIs, XML strings), because nodes have already been parsed* For historical reasons, the order of the 2nd and 3rd argument is different to [[#db:add|db:add]] and [[#db:create|db:create]]specified backup file will be renamed.|-valign="top"
| '''Errors'''
|{{Error|openbackup|#Errors}} the addressed No backup file found.<br/>{{Error|name|#Errors}} invalid database does not exist or could not be openedname.<br/>{{Error|targetconflict|#Errors}} the path points to a directorysame database was addressed more than once.|-valign="top"
| '''Examples'''
|
* {{Code|db:replacealter-backup("DB", "docs/dir/doc.xml", "/home/dir/doc.xml"DB2)}} replaces the content renames all backups of the document {{Code|docs/dir/doc.xml}} in the database {{Code|DB}} with the content of the file {{Code|/home/dir/doc.xml}}.* to {{Code|db:replace("DB", "docs/dir/doc.xml", "<a/>")DB2}} replaces the content of the document {{Code|docs/dir/doc.xml}} in the database {{Code|DB}} with {{Code|&lt;a/&gt;}}.* {{Code|db:replace("DB", "docs/dir/doc.xml", document { <a/> })}} replaces the content of the document {{Code|docs/dir/doc.xml}} in the database {{Code|DB}} with the specified document node.The following query can be used to import files from a directory to a database:<syntaxhighlight lang="xquery">let $source := '/home/john/xml/source'for $file in file:list($source, true())let $path := $source || $filewhere not(file:is-dir($path))return db:replace('db', $file, doc($path))</syntaxhighlight>
|}
==db:storerestore==
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:storerestore|$db name as xs:string, $path as xs:string, $input as item()|empty-sequence()}}|-valign="top"
| '''Summary'''
|Replaces a binary resource Restores the database with the specified by {{Code|$inputname}} in the database . The {{Code|$dbname}} and may include the timestamp of the location specified by {{Code|$path}}backup file. If no name is supplied, general data will be restored. If general data is restored, or adds it as new resourcewill only be available after BaseX has been restarted.|-valign="top"
| '''Errors'''
|{{Error|openlock|#Errors}} the addressed a database does not exist or could not be is openedby another process.<br/>{{Error|mainmemname|#Errors}} invalid database name.<br/>{{Error|no-backup|#Errors}} No backup found.<br/>{{Error|conflict|#Errors}} the same database is not ''persistent'' (stored on disk)was addressed more than once.|-valign="top"
| '''Examples'''
|
* {{Code|db:storerestore("DB", "video/sample.mov", file:read-binary('video.mov'))}} stores restores the addressed video file at the specified locationdatabase {{Code|DB}}.* With the following query, you can copy full directories{{Code|db:<syntaxhighlight lang=restore("xquery">let $db := 'db'let $srcDB-path := 'src/'let $trg-path := 'trg/'for $src in db:list($db, $src2014-path)where db:is03-raw($db, $src)let $trg := $trg13-path || substring18-after($src, $src05-path45")return db:store($db, $trg, db:retrieve($db, $src))</syntaxhighlight>}} restores the database {{Code|DB}} from the backup file with the given timestamp.
|}
==db:flushbackups==
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:flushbackups||element(backup)*}}<br/>{{Func|db:backups|$db as xs:string|empty-sequenceelement(backup)*}}|-valign="top"
| '''Summary'''
|Explicitly flushes the buffers of the Returns an element sequence containing all available database backups with timestamp, file size and comment.<br/>If a database {{Code|$db}}. This command is only useful if {{Option|AUTOFLUSH}} has been set specified, the sequence will be restricted to {{Code|false}}the backups matching this database.|-valign="top"| '''ErrorsExamples'''|* {{ErrorCode|opendb:backups("factbook")}} returns all backups that have been made from the {{Code|#Errorsfactbook}} the addressed database does not exist or could not be opened.
|}
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:name|$node as node()|xs:string}}
|-valign="top"
| '''Summary'''
|Returns the name of the database in which the specified [[#Database Nodes|database node]] {{Code|$node}} is stored.
|-valign="top"
| '''Errors'''
|{{Error|node|#Errors}} {{Code|$nodes}} contains a node which is not stored in a database.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:path|$node as node()|xs:string}}
|-valign="top"
| '''Summary'''
|Returns the path of the database document in which the specified [[#Database Nodes|database node]] {{Code|$node}} is stored.
|-valign="top"
| '''Errors'''
|{{Error|node|#Errors}} {{Code|$nodes}} contains a node which is not stored in a database.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:exists|$db as xs:string|xs:boolean}}<br/>{{Func|db:exists|$db as xs:string, $path as xs:string|xs:boolean}}
|-valign="top"
| '''Summary'''
|Checks if the database {{Code|$db}} or the resource specified by {{Code|$path}} exists. {{Code|false}} is returned if a database directory has been addressed.
|-valign="top"
| '''Examples'''
|
|}
==db:type== {{Announce|Introduced with BaseX 10:}} Replaces {{Code|db:is-raw==}} and {{Code|db:is-xml}}.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:is-rawtype|$db as xs:string, $path as xs:string|xs:boolean}}|-valign="top"
| '''Summary'''
|Checks if Returns the specified type of a resource – {{Code|xml}}, {{Code|binary}}, or {{Code|value}} – in the database {{Code|$db}} and at the path specified {{Code|$path}} exists, and if it is a [[Binary Data|binary resource]].|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.
|-| '''Examples'''|* {{Code|db:is-raw(valign="DBtop", "music/01.mp3")}} returns {{Code|true}}.|} ==db:is-xml== {| width='100%'|-| width='120' | '''Signatures'''|{{Func|db:is-xml|$db as xs:string, $path as xs:string|xs:boolean}}|-| '''Errors'''|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.|-| '''Summary'''|Checks if the specified resource in the database {{Code|$db}} and the path {{Code|$path}} exists, and if it is an XML document.|-
| '''Examples'''
|
* {{Code|db:is-xmltype("DB", "dir/docfactbook.xml")}} returns {{Code|true}}if the specified resource is an XML document.
|}
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|db:content-type|$db as xs:string, $path as xs:string|xs:string}}
|-valign="top"
| '''Summary'''
|Retrieves the content type of a resource in the database {{Code|$db}} and the path {{Code|$path}}.<br/>The file extension is used to recognize the content-type of a resource stored in the database. Content-type {{Code|application/xml}} will be returned for any XML document stored in the database, regardless of its file name extension.
|-valign="top"
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.
|-valign="top"
| '''Examples'''
|
! width="110"|Code
|Description
|-valign="top"
|{{Code|args}}
|The number of specified inputs and paths differs.
|-valign="top"
|{{Code|conflict}}
|Multiple update operations point to the same target.
|-valign="top"
|{{Code|lock}}
|A database cannot be updated because it is opened by another process.
|-valign="top"
|{{Code|mainmem}}
|The addressed database is not ''persistent'' (stored on disk).
|-valign="top"
|{{Code|name}}
|The name of the specified database is invalid.
|-valign="top"
|{{Code|no-backup}}
|No backup exists for a database.
|-valign="top"
|{{Code|node}}
|The referenced XML node is no [[#Database Nodes|database node]], i.e. it is neither stored in a database nor represented as database fragment.
|-valign="top"
|{{Code|no-index}}
|The database lacks an index structure required by the called function.
|-valign="top"
|{{Code|open}}
|The addressed database does not exist or could not be opened.
|-valign="top"
|{{Code|option}}
|The specified option is unknown.
|-valign="top"
|{{Code|path}}
|The specified database path is invalid.
|-valign="top"
|{{Code|property}}
|The specified database property is unknown.
|-valign="top"
|{{Code|range}}
|The addressed database id or pre value is out of range.
|-valign="top"
|{{Code|target}}
|Path points to an invalid target.
=Changelog=
;Version 910* Added: {{Function||db:get}}, {{Function||db:put}}, {{Function||db:type}}.8* UpdatedAdded: [[#dbBackups|Backups]]:backupsSupport for general data ([[User Management|db:backupsregistered users]], [[Job Module#Services|scheduled services]] and [[Store Module|key-value stores]]).* Updated: {{Function||db:get}}, {{Function||db:get-id}}, {{Function||db:get-pre}} renamed (before: {{Code|db:open}}, {{Code|db:createopen-id}}, {{Code|db:open-pre}})* Updated: {{Function||db:put}} renamed (before: {{Code|db:replace}}); function signature aligned with {{Function||db:add}} (second and third argument swapped).* Updated: {{Function||db:put-binary}} renamed (before: {{Code|db:store}}); function signature aligned with {{Function||db:add}} (second and third argument swapped).* Updated: {{Function||db:get-binary}} renamed (before: {{Code|db:retrieve}}).* Updated: {{Function||db:backups}}, {{Function||db:create-backup]]}}: Options added.* Removed: {{Code|db:is-raw}}, {{Code|db:is-raw}} (new: {{Function||db: Support for commentstype}}).
;Version 9.3
* Added: [[#db:alter-backup{{Function||db:alter-backup]]}}* Updated: [[#db:open-id{{Code|db:open-id]]}}, [[#db:open-pre{{Code|db:open-pre]]}}: support for multiple integers
;Version 9.2
* Added: [[#db:dir{{Function||db:dir]]}}* Updated: [[#db:add{{Function||db:add]]}}: {{Code|$path}} allow empty path argument
;Version 9.0
* Added: [[#db:option{{Function||db:option]]}}
* Updated: db:output renamed to {{Function|Update|update:output}}, db:output-cache renamed to {{Function|Update|update:cache}}
* Updated: error codes updated; errors now use the module namespace
;Version 8.6
* Added: [[#db:property{{Function||db:property]]}}
;Version 8.4
* Updated: [[#db:create{{Function||db:create]]}}, [[#db:add{{Function||db:add]]}}, [[#db:replace{{Code|db:replace]]}}: support for {{Code|ADDCACHE}} option.* Added: [[#db:token{{Function||db:token]]}}
;Version 8.3
* Updated: [[#db:list-details{{Function||db:list-details]]}}: attributes with name of database and date of backup added to results.* Updated: [[#db:backups{{Function||db:backups]] }} now include attributes with name of database and date of backup.* Updated: [[#Value Indexes{{Function|Database|Value Indexes]]}}: raise error if no index exists.
;Version 8.2
* Added: [[#db:output-cache{{Function||db:output-cache]]}}
* Removed: db:event
;Version 7.9
* Updated: parsing options added to [[#db:create{{Function||db:create]]}}, [[#db:add{{Function||db:add]] }} and [[#db:replace{{Code|db:replace]]}}.
* Updated: allow {{Option|UPDINDEX}} if {{Code|$all}} is {{Code|true}}.
;Version 7.8.2
* Added: [[#db:alter{{Function||db:alter]]}}, [[#db:copy{{Function||db:copy]]}}, [[#db:create-backup{{Function||db:create-backup]]}}, [[#db:drop-backup{{Function||db:drop-backup]]}}, [[#db:restore{{Function||db:restore]]}}
;Version 7.8
* Removed: db:fulltext (use [[{{Function|Full-Text Module#ft:search|ft:search]] }} instead)
;Version 7.7
* Added: [[#db:export{{Function||db:export]]}}, [[#db:name{{Function||db:name]]}}, [[#db:path{{Function||db:path]]}}* Updated: {{Code|$options}} argument added to [[#db:create{{Function||db:create]] }} and [[#db:optimize{{Function||db:optimize]]}}.* Updated: the functions no longer accept [[#Database Nodes|Database Nodesdatabase nodes]] as reference. Instead, the name of a database must now be specified.
;Version 7.6
* Updated: [[#db:create{{Function||db:create]]}}: allow more than one input and path.
;Version 7.5
* Updated: [[#db:add{{Function||db:add]]}}: input nodes will be automatically converted to document nodes* Added: [[#db:backups{{Function||db:backups]]}}* Added: [[#db:create{{Function||db:create]]}}* Added: [[#db:drop{{Function||db:drop]]}}
;Version 7.3
* Added: [[#db:flush{{Function||db:flush]]}}
;Version 7.2.1
* Added: [[#db:text-range{{Function||db:text-range]]}}, [[#db:attribute-range{{Function||db:attribute-range]]}}, [[#db:output{{Function||db:output]]}}
;Version 7.1
* Added: [[#db:list-details{{Function||db:list-details]]}}, [[#db:content-type{{Function||db:content-type]]}}* Updated: [[#db:info{{Function||db:info]]}}, [[#db:system{{Function||db:system]]}}, [[#db:retrieve{{Code|db:retrieve]]}}
;Version 7.0
* Added: [[#{{Function||db:retrieveexists}}, {{Code|db:retrieve]]}}, [[#db:store{{Code|db:store]]}}, [[#db:exists{{Code|db:exists]], [[#db:is-raw|db:is-raw]]}}, [[#db:is-xml{{Code|db:is-xml]]}}* Updated: [[#db:list{{Function||db:list]]}}, [[#db:open{{Code|db:open]]}}, [[#db:add{{Function||db:add]]}}
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu