Changes

Jump to navigation Jump to search
2,137 bytes added ,  15:38, 20 May 2013
no edit summary
{{Mark|With Version 7.7}}, the functions no longer accept database nodes as reference. Instead, the name of a database must now be specified.
{{Error|BXDB0002|#Errors}} may be raised if the addressed database cannot be opened.
Database nodes are XML nodes which are either stored in a persistent database or part of a so-called ''database fragment''. All XML fragments can be converted to database fragments by e. g. applying the [[XQuery_Update#transform|transform]] expression on an XML fragment:
|-
| '''Summary'''
|Returns meta information on the database specified by the database {{Code|$db}}. The output is similar to the [[Commands#INFO DB|INFO DB]] command.|-| '''Errors'''|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.
|}
* If a database {{Code|$db}} is specified, all documents and raw files of the specified database are returned.
* The list of resources can be further restricted by the {{Code|$path}} argument.
|-
| '''Errors'''
|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.
|-
| '''Examples'''
* If a database {{Code|$db}} is specified, all documents and raw files of the specified database together with their content-type, the modification date and the resource type are returned.
* The list of resources can be further restricted by the {{Code|$path}} argument.
|-
| '''Errors'''
|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.
|-
| '''Examples'''
|-
| '''Summary'''
|Returns a sequence with all document nodes contained in the database specified by the database {{Code|$db}}.<br/>The document nodes to be returned can be restricted by the {{Code|$path}} argument.|-| '''Errors'''|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.
|-
| '''Examples'''
|-
| '''Summary'''
|Opens the database specified by the database {{Code|$db}} and returns the node with the specified {{Code|$id}} value.<br />Each database node has a persistent ''id'', which remains valid after update operations. If no updates are performed, the ''pre'' value can be requested, which provides access to database nodes in constant time.
|-
| '''Errors'''
|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.<br/>{{Error|BXDB0009|XQuery Errors#BaseX Errors}} the specified id value does not exist in the database.
|}
|-
| '''Summary'''
|Opens the database specified by the database {{Code|$db}} and returns the node with the specified {{Code|$pre}} value.<br />The ''pre'' value provides access to a database node in constant time, but it is ''transient'', i.e., it may change when database updates are performed.
|-
| '''Errors'''
|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.<br/>{{Error|BXDB0009|XQuery Errors#BaseX Errors}} the specified pre value does not exist in the database.
|-
| '''Examples'''
|-
| '''Errors'''
|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.<br/>{{Error|BXDB0003|#Errors}} the database is not ''persistent'' (stored on disk).<br/>{{Error|FODC0002|XQuery Errors#Functions Errors}} the addressed resource cannot be retrieved.<br/>{{Error|FODC0007|XQuery Errors#Functions Errors}} the specified path is invalid.
|-
| '''Examples'''
|-
| '''Summary'''
|Returns all text nodes of the database specified by the database {{Code|$db}} that have {{Code|$string}} as their string value. If available, the value index is used to speed up evaluation.|-| '''Errors'''|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.
|-
| '''Examples'''
|-
| '''Summary'''
|Returns all text nodes of the database specified by the database {{Code|$db}} that are located in between the {{Code|$min}} and {{Code|$max}} strings. If available, the value index is used to speed up evaluation.|-| '''Errors'''|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.
|-
| '''Examples'''
|-
| '''Summary'''
|Returns all attribute nodes of the database specified by the database {{Code|$db}} that have {{Code|$string}} as string value. If available, the value index is used to speed up evaluation.<br />If {{Code|$attname}} is specified, the resulting attribute nodes are filtered by their attribute name.|-| '''Errors'''|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.
|-
| '''Examples'''
|-
| '''Summary'''
|Returns all attributes of the database specified by 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}}. If available, the value index is used to speed up evaluation.|-| '''Errors'''|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.
|-
| '''Examples'''
|-
| '''Summary'''
|Returns all text nodes from the full-text index of the database specified by the database {{Code|$db}} that contain the text specified as {{Code|$terms}}.<br/>The options used for building the full-text will also be applied to the search terms. As an example, if the index terms have been stemmed, the search string will be stemmed as well.
|-
| '''Errors'''
|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.<br/>{{Error|BXDB0004|#Errors}} the full-text index is not available.
|-
| '''Examples'''
|-
| '''Summary'''
|Drops the database specified by the database {{Code|$db}} and all connected resources.
|-
| '''Errors'''
|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.<br/>{{Error|BXDB0007|#Errors}} {{Code|$db}} is opened by another process.
|-
| '''Examples'''
|-
| '''Summary'''
|Adds documents specified by {{Code|$input}} to the database specified by the database {{Code|$db}} and the specified {{Code|$path}}.<br/>{{Code|$input}} may be a string or a node different than attribute. If the {{Code|$input}} source is not a file or a folder, {{Code|$path}} must be specified.
|-
| '''Errors'''
|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.<br/>{{Error|FODC0002|XQuery Errors#Functions Errors}} {{Code|$input}} points to an unknown resource.<br/>{{Error|FOUP0001|XQuery Errors#Update Errors}} {{Code|$input}} is neither string nor a document node.
|-
| '''Examples'''
|-
| '''Summary'''
|Deletes document(s), specified by {{Code|$path}}, from the database specified by the database {{Code|$db}}.|-| '''Errors'''|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.
|-
| '''Examples'''
|-
| '''Summary'''
|Optimizes the meta data and indexes of the database specified by the database {{Code|$db}}.<br/>If {{Code|$all}} is set to {{Code|true()}}, the complete database will be rebuilt.
|-
| '''Errors'''
|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.<br/>{{Error|FOUP0002|XQuery Errors#Update Errors}} an error occurred while optimizing the database.
|-
| '''Examples'''
|-
| '''Summary'''
|Renames document(s), specified by {{Code|$path}} to {{Code|$newpath}} in the database specified by the database {{Code|$db}}.
|-
| '''Errors'''
|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.<br/>{{Error|BXDB0008|#Errors}} new document names would be empty.
|-
| '''Examples'''
|-
| '''Summary'''
|Replaces a document, specified by {{Code|$path}}, in the database specified by the database {{Code|$db}} with the content of {{Code|$input}}, or adds it as a new document.
|-
| '''Errors'''
|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.<br/>{{Error|BXDB0014|#Errors}} {{Code|$path}} points to a directory.<br/>{{Error|FODC0002|XQuery Errors#Functions Errors}} {{Code|$input}} is a string representing a path, which cannot be read.<br/>{{Error|FOUP0001|XQuery Errors#Update Errors}} {{Code|$input}} is neither a string nor a document node.
|-
| '''Examples'''
|-
| '''Summary'''
|Stores a binary resource specified by {{Code|$input}} in the database specified by the database {{Code|$db}} and the location specified by {{Code|$path}}.
|-
| '''Errors'''
|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.<br/>{{Error|BXDB0003|#Errors}} the database is not ''persistent'' (stored on disk).<br/>{{Error|FODC0007|XQuery Errors#Functions Errors}} the specified path is invalid.<br/>{{Error|FOUP0002|XQuery Errors#Update Errors}} the resource cannot be stored at the specified location.
|-
| '''Examples'''
|-
| '''Summary'''
|Explicitly flushes the buffers of the database specified by the database {{Code|$db}}. This command is only useful if [[Options#AUTOFLUSH|AUTOFLUSH]] has been set to {{Code|false}}.|-| '''Errors'''|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.
|}
|-
| '''Summary'''
|Checks if the database specified by the database {{Code|$db}} or the resource specified by {{Code|$path}} exists. {{Code|false}} is returned if a database directory has been addressed.
|-
| '''Examples'''
|-
| '''Summary'''
|Checks if the specified resource in the database specified by the database {{Code|$db}} and the path {{Code|$path}} exists, and if it is a raw file.|-| '''Errors'''|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.
|-
| '''Examples'''
| width='90' | '''Signatures'''
|{{Func|db:is-xml|$db as xs:string, $path as xs:string|xs:boolean}}
|-
| '''Errors'''
|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.
|-
| '''Summary'''
|Checks if the specified resource in the database specified by the database {{Code|$db}} and the path {{Code|$path}} exists, and if it is an XML document.
|-
| '''Examples'''
|-
| '''Summary'''
|Retrieves the content type of a resource in the database specified by 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.
|-
| '''Errors'''
|{{Error|BXDB0002|XQuery Errors#BaseX Errors}} The addressed database does not exist or could not be opened.<br/>{{Error|FODC0002|XQuery Errors#Functions Errors}} the addressed resource is not found or cannot be retrieved.
|-
| '''Examples'''
|-
|{{Code|BXDB0002}}
|An I/O error occurred while opening a The addressed databasedoes not exist or could not be opened.
|-
|{{Code|BXDB0003}}
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu