Changes

Jump to navigation Jump to search
8,857 bytes added ,  11:56, 6 December 2010
Created page with "<p>This module contains methods to list and open databases, explicitly apply available index structures, or get information on the database structure. All functions are introduce..."
<p>This module contains methods to list and open databases, explicitly apply available index structures, or get information on the database structure. All functions are introduced with the <code>db:</code> prefix.</p>
==Overview==
<p>
<a href="xqdb#attribute-index">attribute-index</a> | <a href="xqdb#fulltext-index">fulltext-index</a> | <a href="xqdb#index-info">index-info</a> | <a href="xqdb#info">info</a> | <a href="xqdb#list">list</a> | <a href="xqdb#open">open</a> | <a href="xqdb#open-id">open-id</a> | <a href="xqdb#open-pre">open-pre</a> | <a href="xqdb#system">system</a> | <a href="xqdb#text-index">text-index</a>
</p>

==db:system==
<table>
<tr>
<td width="90">
<b>Signatures</b>
</td>
<td>
<code>
<b>db:system</b>() as xs:string*</code>
<br />
</td>
</tr>
<tr>
<td>
<b>Summary</b>
</td>
<td>Lists information on the database system.</td>
</tr>
<tr>
<td>
<b>Rules</b>
</td>
<td>This function returns general information on the database system, such as the database path and current database settings.<br />
</td>
</tr>
</table>

==db:list==
<table>
<tr>
<td width="90">
<b>Signatures</b>
</td>
<td>
<code>
<b>db:list</b>() as xs:string*</code>
<br />
</td>
</tr>
<tr>
<td>
<b>Summary</b>
</td>
<td>Lists all databases.</td>
</tr>
<tr>
<td>
<b>Rules</b>
</td>
<td>This function returns a <code>xs:string</code> sequence with the names of all databases.<br />
</td>
</tr>
</table>

==db:open==
<table>
<tr>
<td width="90">
<b>Signatures</b>
</td>
<td>
<code>
<b>db:open</b>($name as xs:string) as document-node()</code>
<br />
</td>
</tr>
<tr>
<td>
<b>Summary</b>
</td>
<td>Returns documents from a database.</td>
</tr>
<tr>
<td>
<b>Rules</b>
</td>
<td>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 />
</td>
</tr>
<tr>
<td>
<b>Examples</b>
</td>
<td>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 />
</td>
</tr>
<tr>
<td>
<b>Errors</b>
</td>
<td>
<b>[BASX0003]</b> is raised if the database is not found.<br />
</td>
</tr>
</table>

==db:open-pre==
<table>
<tr>
<td width="90">
<b>Signatures</b>
</td>
<td>
<code>
<b>db:open-pre</b>($name as xs:string, $pre as xs:integer) as node()</code>
<br />
</td>
</tr>
<tr>
<td>
<b>Summary</b>
</td>
<td>Returns a specific database node.</td>
</tr>
<tr>
<td>
<b>Rules</b>
</td>
<td>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 />
</td>
</tr>
<tr>
<td>
<b>Examples</b>
</td>
<td>The expression <code>db:open-pre("docs", 0)</code> returns the first database node from the database named <code>docs</code>.<br />
</td>
</tr>
<tr>
<td>
<b>Errors</b>
</td>
<td>
<b>[BASX0004]</b> is raised if the specified <code>$pre</code> value does not exist in the database.<br />
</td>
</tr>
</table>

==db:open-id==
<table>
<tr>
<td width="90">
<b>Signatures</b>
</td>
<td>
<code>
<b>db:open-id</b>($name as xs:string, $id as xs:integer) as node()</code>
<br />
</td>
</tr>
<tr>
<td>
<b>Summary</b>
</td>
<td>Returns a specific database node.</td>
</tr>
<tr>
<td>
<b>Rules</b>
</td>
<td>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 />
</td>
</tr>
<tr>
<td>
<b>Errors</b>
</td>
<td>
<b>[BASX0004]</b> is raised if the specified <code>$id</code> does not exist in the database.<br />
</td>
</tr>
</table>

==db:text-index==
<table>
<tr>
<td width="90">
<b>Signatures</b>
</td>
<td>
<code>
<b>db:text-index</b>($string as item()) as text()*</code>
<br />
</td>
</tr>
<tr>
<td>
<b>Summary</b>
</td>
<td>Returns results from a text index request.</td>
</tr>
<tr>
<td>
<b>Rules</b>
</td>
<td>This function accesses the text index and returns all text nodes that have <code>$string</code> as string value.<br />
</td>
</tr>
<tr>
<td>
<b>Errors</b>
</td>
<td>
<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 />
</td>
</tr>
</table>

==db:attribute-index==
<table>
<tr>
<td width="90">
<b>Signatures</b>
</td>
<td>
<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 />
</td>
</tr>
<tr>
<td>
<b>Summary</b>
</td>
<td>Returns results from a attribute index request.</td>
</tr>
<tr>
<td>
<b>Rules</b>
</td>
<td>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 />
</td>
</tr>
<tr>
<td>
<b>Errors</b>
</td>
<td>
<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 />
</td>
</tr>
</table>

==db:fulltext-index==
<table>
<tr>
<td width="90">
<b>Signatures</b>
</td>
<td>
<code>
<b>db:fulltext-index</b>($text as xs:string) as text()</code>
<br />
</td>
</tr>
<tr>
<td>
<b>Summary</b>
</td>
<td>Returns results from a full-text index request.</td>
</tr>
<tr>
<td>
<b>Rules</b>
</td>
<td>This function accesses the full-text index and returns all text nodes that contain <code>$text</code>.<br />
</td>
</tr>
<tr>
<td>
<b>Errors</b>
</td>
<td>
<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 />
</td>
</tr>
</table>

==db:info==
<table>
<tr>
<td width="90">
<b>Signatures</b>
</td>
<td>
<code>
<b>db:info</b>() as xs:string</code>
<br />
</td>
</tr>
<tr>
<td>
<b>Summary</b>
</td>
<td>Returns database information.</td>
</tr>
<tr>
<td>
<b>Rules</b>
</td>
<td>This function returns information on the database that is referenced by the current context item.<br />
</td>
</tr>
<tr>
<td>
<b>Errors</b>
</td>
<td>
<b>[BASX0002]</b> is raised if the context item does not represent a database node.<br />
</td>
</tr>
</table>

==db:index-info==
<table>
<tr>
<td width="90">
<b>Signatures</b>
</td>
<td>
<code>
<b>db:index-info</b>($type as xs:string) as xs:string</code>
<br />
</td>
</tr>
<tr>
<td>
<b>Summary</b>
</td>
<td>Returns database index information.</td>
</tr>
<tr>
<td>
<b>Rules</b>
</td>
<td>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 />
</td>
</tr>
<tr>
<td>
<b>Errors</b>
</td>
<td>
<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 />
</td>
</tr>
</table>
</div>
Anonymous user

Navigation menu