Changes

Jump to navigation Jump to search
1,014 bytes added ,  20:59, 13 December 2010
based on docs2wiki.xq
<p>This module contains methods to list and open [[database|databases]], explicitly apply available [[Indexes|index structures]], or get information on the database structure. All functions are introduced with the <code>db:</code> prefix.</p> ==db:system==
==db:system==
{|
|-
| valign='top' width="'90" ' | <b>'''Signatures</b>'''|<code><b>db:system</b>() as xs:string*</code><br />
|-
| <b>valign='top' | '''Summary</b>'''| Lists information on the database system.
|-
| <b>valign='top' | '''Rules</b>'''| This function returns a simple string with general information on the database system, such as the database path and current database settings.<br />
|}
==db:list==
{|
|-
| valign='top' width="'90" ' | <b>'''Signatures</b>'''|<code><b>db:list</b>() as xs:string*</code><br />
|-
| <b>valign='top' | '''Summary</b>'''| Lists all databases.
|-
| <b>valign='top' | '''Rules</b>'''| This function returns a <code>xs:string</code> sequence with the names of all databases.<br />
|}
==db:open==
{|
|-
| valign='top' width="'90" ' | <b>'''Signatures</b>'''|<code><b>db:open</b>($name as xs:string) as document-node()</code><br />
|-
| <b>valign='top' | '''Summary</b>'''| Returns Retrieves documents from a database.
|-
| <b>valign='top' | '''Rules</b>'''| This function opens the documents of the database specified by <code>$name</code>. The name of the database may be extended by a collection path.<br />
|-
| <b>valign='top' | '''Examples</b>'''| The expression <code>db:open("docs")</code> returns all documents from the database named <code>docs</code>.<br />The expression <code>db:open("docs/one")</code> returns all documents from the database named <code>docs</code> in the subpath <code>one</code>.<br />
|-
| <b>valign='top' | '''Errors</b>'''| <b>[BASX0003]</b> is raised if the database is not found.<br />
|}
==db:open-pre==
{|
|-
| valign='top' width="'90" ' | <b>'''Signatures</b>'''|<code> <b>db:open-pre</b>($name as xs:string, $pre as xs:integer) as node()</code><br />
|-
| <b>valign='top' | '''Summary</b>'''| Returns a specific database node.
|-
| <b>valign='top' | '''Rules</b>'''| This function opens the database specified by <code>$name</code> and returns the node with the <i>pre</i> value specified by <code>$pre</code>.<br />
|-
| <b>valign='top' | '''Examples</b>'''| The expression <code>db:open-pre("docs", 0)</code> returns the first database node from the database named <code>docs</code>.<br />
|-
| <b>valign='top' | '''Errors</b>'''| <b>[BASX0004]</b> is raised if the specified <code>$pre</code> value does not exist in the database.<br />
|}
==db:open-id==
{|
|-
| valign='top' width="'90" ' | <b>'''Signatures</b>'''|<code><b>db:open-id</b>($name as xs:string, $id as xs:integer) as node()</code><br />
|-
| <b>valign='top' | '''Summary</b>'''| Returns a specific database node.
|-
| <b>valign='top' | '''Rules</b>'''| This function opens the database specified by <code>$name</code> and returns the node with the <i>id</i> value specified by <code>$id</code>.<br />In contrast to the <i>pre</i> value, the <i>id</i> will remain valid after update operations.<br />
|-
| <b>valign='top' | '''Errors</b>'''| <b>[BASX0004]</b> is raised if the specified <code>$id</code> does not exist in the database.<br />
|}
==db:text-index==
{|
|-
| valign='top' width="'90" ' | <b>'''Signatures</b>'''|<code><b>db:text-index</b>($string as item()) as text()*</code><br />
|-
| <b>valign='top' | '''Summary</b>'''| Returns results from a text [[indexes|index]] request.
|-
| <b>valign='top' | '''Rules</b>'''| This function accesses the text index and returns all text nodes that have <code>$string</code> as string value.<br />
|-
| valign='top' | '''Examples'''|The expression <bcode>Errorsdb:text("QUERY")</code> returns all text nodes of the currently opened database that match the string <code>QUERY</code>.<br />The expression <code>db:open("DB")/db:text("QUERY")/..</code> returns the parents of all text nodes of the database <code>DB</code> that match the string <code>QUERY</code>.<br /b>|-| valign='top' | '''Errors'''|<b>[BASX0001]</b> is raised if the index is not available.<br /> <b>[BASX0002]</b> is raised if the context item does not represent a database node.<br />
|}
==db:attribute-index==
{|
|-
| valign='top' width="'90" ' | <b>'''Signatures</b>'''|<code><b>db:attribute-index</b>($string as item()) as attribute()*</code> <br /> <code> <b>db:attribute-index</b>($string as item(), $name as xs:string) as attribute()*</code><br />
|-
| <b>valign='top' | '''Summary</b>'''| Returns results from a attribute [[indexes|index]] request.
|-
| <b>valign='top' | '''Rules</b>'''| This function accesses the attribute index and returns all attribute nodes that have <code>$string</code> as string value.<br />If <code>$name</code> is specified, the resulting attribute nodes are filtered by their attribute name.<br />
|-
| valign='top' | '''Examples'''|The expression <code>db:open("DB")/db:attribute("QUERY", "id")/..</code> returns the parents of all attribute nodes of the database <code>DB</code> that have <bcode>QUERY</code>Errorsas string value.<br /b>|-| valign='top' | '''Errors'''|<b>[BASX0001]</b> is raised if the index is not available.<br /><b>[BASX0002]</b> is raised if the context item does not represent a database node.<br />
|}
==db:fulltext-index==
{|
|-
| valign='top' width="'90" ' | <b>'''Signatures</b>'''|<code><b>db:fulltext-index</b>($text as xs:string) as text()</code><br />
|-
| <b>valign='top' | '''Summary</b>'''| Returns results from a full-text [[indexes|index]] request.
|-
| <b>valign='top' | '''Rules</b>'''| This function accesses the full-text index and returns all text nodes that contain the string <code>$text</code>. The index full-text options are used for searching, i.e., if the index terms were stemmed, the search string will be stemmed as well.<br />
|-
| valign='top' | '''Examples'''|The expression <bcode>Errorsdb:fulltext("QUERY")</code> returns all text nodes of the currently opened database that contain the string <code>QUERY</code>.<br /b>|-| valign='top' | '''Errors'''|<b>[BASX0001]</b> is raised if the index is not available.<br /> <b>[BASX0002]</b> is raised if the context item does not represent a database node.<br />
|}
==db:info==
{|
|-
| valign='top' width="'90" ' | '''Signatures'''| <code><b>Signaturesdb:info</b>|() as xs:string</code><br /><code> <b>db:info</b>($type as xs:string) as xs:string</code><br />
|-
| <b>valign='top' | '''Summary</b>'''| Returns database information.
|-
| <b>valign='top' | '''Rules</b>'''| This function returns information on the database that is referenced by the current context item.<br />If <code>$type</code> is specified, the funnction 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>.<br />
|-
| valign='top' | '''Errors'''| <b>Errors[BASX0001]</b>|is raised if the specified index is not available.<br /><b>[BASX0002]</b> is raised if the context item does not represent a database node.<br />
|}
==db:index-info==
{|
|-
| width="90" | <b>Signatures</b>
| <code> <b>db:index-info</b>($type as xs:string) as xs:string</code>
|-
| <b>Summary</b>
| Returns database [[indexes|index]] information.
|-
| <b>Rules</b>
| This function returns information on an index of the database that is referenced by the current context item.<br /> <code>$type</code> 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>.<br />
|-
| <b>Errors</b>
| <b>[BASX0001]</b> is raised if the specified index is not available.<br /> <b>[BASX0002]</b> is raised if the context item does not represent a database node.<br />
|}
[[Category:Commands]]
[[Category:XQuery]]
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu