Changes

Jump to navigation Jump to search
3,178 bytes added ,  16:35, 12 December 2010
m
Reverted edits by AW (talk) to last revision by Michael
<p>This module offers utility contains methodsto list and open databases, which can be used for testing and profiling explicitly apply available index structures, or get information on the codedatabase structure. All functions are preceded by introduced with the <code>utildb:</code> prefix. </p>==db:system==
{||-| width==util"90" | <b>Signatures</b>|<code><b>db:system</b>() as xs:eval== string*</code>  |-| <b>Summary</b>| Lists information on the database system.|-| <b>Rules</b>| This function returns general information on the database system, such as the database path and current database settings.<br />|}
==db:list==
{|
|-
| width="90" | <b>Signatures</b>
|<code><b>utildb:evallist</b>($expr ) as xs:string) as item()*</code>
|-
| <b>Summary</b>
| Evaluates the argument at runtimeLists all databases.
|-
| <b>Rules</b>
| This function dynamically evaluates returns a <code>xs:string</code> sequence with the names of all databases.<br />|} ==db:open== {||-| width="90" | <b>Signatures</b>|<code><b>db:open</b>($name as xs:string) as document-node()</code> |-| <b>Summary</b>| Returns documents from a database.|-| <b>Rules</b>| This function opens the documents of the database specified by <code>$exprname</code> as XQuery expression and returns . The name of the resulting itemsdatabase may be extended by a collection path.<br />
|-
| <b>Examples</b>
| The expression <code>utildb:evalopen("1+3docs")</code> returns all documents from the database named <code>4docs</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>Errors</b>| <b>[BASX0003]</b> is raised if the database is not found.<br />
|}
==utildb:runopen-pre== {||-| width="90" | <b>Signatures</b>|<code> <b>db:open-pre</b>($name as xs:string, $pre as xs:integer) as node()</code> |-| <b>Summary</b>| Returns a specific database node.|-| <b>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>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>Errors</b>| <b>[BASX0004]</b> is raised if the specified <code>$pre</code> value does not exist in the database.<br />|}
==db:open-id==
{|
|-
| width="90" | <b>Signatures</b>
|<code><b>utildb:runopen-id</b>($input name as xs:string, $id as xs:integer) as itemnode()*</code>
|-
| <b>Summary</b>
| Opens the argument as file and evaluates it as at runtimeReturns a specific database node.
|-
| <b>Rules</b>
| This function opens the database specified by <code>$inputname</code> as file, evaluates it as XQuery expression, and returns the resulting itemsnode 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>Errors</b>| <b>[BASX0004]</b> is raised if the specified <code>$id</code> does not exist in the database.<br />
|}
==utildb:mbtext-index== {||-| width="90" | <b>Signatures</b>|<code><b>db:text-index</b>($string as item()) as text()*</code> |-| <b>Summary</b>| Returns results from a text index request.|-| <b>Rules</b>| This function accesses the text index and returns all text nodes that have <code>$string</code> as string value.<br />|-| <b>Errors</b>|<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== {||-| 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> |-| <b>Summary</b>| Returns results from a attribute index request.|-| <b>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 />|-| <b>Errors</b>|<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.|}
==db:fulltext-index==
{|
|-
| width="90" | <b>Signatures</b>
|<code><b>utildb:mbfulltext-index</b>($expr as item()) text as xs:double</code>|<code><b>util:mb</b>($expr string) as itemtext(), $cache as xs:boolean) as xs:double</code>
|-
| <b>Summary</b>
| Measures the memory consumption for evaluating the argumentReturns results from a full-text index request.
|-
| <b>Rules</b>
| This function measures accesses the amount of memory full-text index and returns all text nodes that is needed to evaluate contain <code>$exprtext</code>. If the value of <code>$cache</code> is <code>true()</code>, the result will be cached. The returned <code>xs:double</code> value represents the amount of memory in megabytes.<br />
|-
| <b>ExamplesErrors</b>| The expression <codeb>util:mb("1 to 100000")[BASX0001]</code> might return <code>0</codeb>is raised if the index is not available.<br />The expression <codeb>util:mb("1 to 100000", true())[BASX0002]</code> might return <code>26.678</codeb>is raised if the context item does not represent a database node.<br />
|}
==util:ms==
==db:info==
{|
|-
| width="90" | <b>Signatures</b>
|<code><b>utildb:msinfo</b>($expr as item()) as xs:double</code>|<code><b>util:ms</b>($expr as item(), $cache as xs:boolean) as xs:doublestring</code>
|-
| <b>Summary</b>
| Measures the time needed for evaluating the argumentReturns database information.
|-
| <b>Rules</b>
| This function measures returns information on the time needed to evaluate <code>$expr</code>. If the value of <code>$cache</code> database that is <code>true()</code>, the result will be cached. The returned <code>xs:double</code> value represents referenced by the needed time in millisecondscurrent context item.<br />
|-
| <b>ExamplesErrors</b>| The expression <codeb>util:ms("1 to 100000")[[BASX0002]]</code> might return <code>25.69</code>.<br />The expression <code>util:ms("1 to 100000", true())</code> might return <code>208.12</codeb>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 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:XQueryWikify]]
bueraucrat, Bureaucrats, editor, reviewer, Administrators
907

edits

Navigation menu