Difference between revisions of "Database Module"
Jump to navigation
Jump to search
m (→db:info: missing full stop) |
(→db:info: db:info() will not be supported in 6.7) |
||
Line 148: | Line 148: | ||
|- | |- | ||
| valign='top' width='90' | '''Signatures''' | | valign='top' width='90' | '''Signatures''' | ||
− | |<code><b>db:info</b>() as xs:string</code><br/><code><b>db:info</b>($type as xs:string) as xs:string</code> <font color="red">Version < 6.7</font><br/><code><b>db:info</b>($name as xs:string) as xs:string</code> <font color="red">Version 6.7</font><br/><code><b>db:info</b>($name as xs:string, $type as xs:string) as xs:string</code> <font color="red">Version 6.7</font> | + | |<code><b>db:info</b>() as xs:string</code> <font color="red">Version < 6.7</font><br/><code><b>db:info</b>($type as xs:string) as xs:string</code> <font color="red">Version < 6.7</font><br/><code><b>db:info</b>($name as xs:string) as xs:string</code> <font color="red">Version 6.7</font><br/><code><b>db:info</b>($name as xs:string, $type as xs:string) as xs:string</code> <font color="red">Version 6.7</font> |
|- | |- | ||
| valign='top' | '''Summary''' | | valign='top' | '''Summary''' | ||
− | |Returns information | + | |Returns information for a database.<br />If <code>$type</code> is specified, the function returns information on a database index. It must be one of the values <code>TEXT</code>, <code>ATTRIBUTE</code>, <code>FULLTEXT</code>, <code>PATH</code>, <code>TAG</code>, or <code>ATTNAME</code>. |
|- | |- | ||
| valign='top' | '''Errors''' | | valign='top' | '''Errors''' |
Revision as of 14:47, 24 June 2011
This module contains XQuery Functions to list and open databases, explicitly apply available index structures, or get information on the database structure. All functions are introduced with the db:
prefix, which is linked to the http://www.basex.org/db
namespace.
Contents
db:system
Signatures | db:system() as xs:string
|
Summary | Prints information about the database system, including the database path and current database settings. |
db:list
Signatures | db:list() as xs:string* db:list($path as xs:string) as xs:string* Version 6.7
|
Summary | Returns an xs:string sequence with the names of all databases. If an argument is specified, all documents of the specified database or database path are returned.
|
db:open
Signatures | db:open($name as xs:string) as document-node()*
|
Summary | Returns a sequence with all document nodes contained in the database specified by $name . The name of the database may be extended by a collection path.
|
Errors | BASX0003 is raised if the database is not found. |
Examples |
|
db:open-pre
Signatures | db:open-pre($name as xs:string, $pre as xs:integer) as node()
|
Summary | Opens the database specified by $name and returns the node with the specified $pre value.
|
Errors | BASX0004 is raised if the specified $pre value does not exist in the database.
|
Examples |
|
db:open-id
Signatures | db:open-id($name as xs:string, $id as xs:integer) as node()
|
Summary | Opens the database specified by $name and returns the node with the specified $id value.In contrast to the pre value, the id will remain valid after update operations. |
Errors | BASX0004 is raised if the specified $id does not exist in the database.
|
db:node-pre
Signatures | db:node-pre($nodes as node()*) as xs:integer*
|
Summary | Returns the pre values of all database nodes specified by $nodes . pre values are direct, internal pointers to database nodes, which might be changed by updates.
|
Examples |
|
db:node-id
Signatures | db:node-id($nodes as node()*) as xs:integer*
|
Summary | Returns the id values of all database nodes specified by $nodes . id values are pointers to database nodes, which are not changed by updates.
|
db:text
Signatures | db:text($string as item()) as text()* Version < 6.7db:text($name as xs:string, $string as item()) as text()* Version 6.7
|
Summary | Returns all text nodes from the text index that have $string as their string value.
|
Errors | BASX0001 is raised if the index is not available. BASX0002 is raised if the context item does not represent a database node. Version < 6.7 |
Examples |
|
db:attribute
Signatures | db:attribute($string as item()) as attribute()* Version < 6.7db:attribute($string as item(), $attname as xs:string) as attribute()* Version < 6.7db:attribute($name as xs:string, $string as item()) as attribute()* Version 6.7db:attribute($name as xs:string, $string as item(), $attname as xs:string) as attribute()* Version 6.7
|
Summary | Returns all attribute nodes from the attribute index that have $string as their string value.If $attname is specified, the resulting attribute nodes are filtered by their attribute name.
|
Errors | BASX0001 is raised if the index is not available. BASX0002 is raised if the context item does not represent a database node. Version < 6.7 |
Examples |
|
db:fulltext
Signatures | db:fulltext($text as xs:string) as text() Version < 6.7db:fulltext($name as xs:string, $text as xs:string) as text() Version 6.7
|
Summary | Returns all text nodes from the full-text index that contain the string $text . The index full-text options are used for searching, i.e., if the index terms have been stemmed, the search string will be stemmed as well.
|
Errors | BASX0001 is raised if the index is not available. BASX0002 is raised if the context item does not represent a database node. Version < 6.7 |
Examples |
|
db:info
Signatures | db:info() as xs:string Version < 6.7db:info($type as xs:string) as xs:string Version < 6.7db:info($name as xs:string) as xs:string Version 6.7db:info($name as xs:string, $type as xs:string) as xs:string Version 6.7
|
Summary | Returns information for a database. If $type is specified, the function returns information on a database index. It must be one of the values TEXT , ATTRIBUTE , FULLTEXT , PATH , TAG , or ATTNAME .
|
Errors | BASX0001 is raised if the specified index is not available. BASX0002 is raised if the context item does not represent a database node. Version < 6.7 |