Changes

Jump to navigation Jump to search
694 bytes added ,  19:20, 20 August 2018
<pre class="brush:xquery">
declare option basex:write-lock 'FILESCONFIGLOCK';
file:write('config.xml', <config/>)
</pre>
This pragma can be helpful when debugging your code.
 
{{Mark|Introduced with Version 9.1:}}
 
In analogy with option declarations and function annotations, [[Transactions#XQuery_Locks|XQuery Locks]] can also set via pragmas:
 
<pre class="brush:xquery">
(# basex:write-lock CONFIGLOCK #) {
file:write('config.xml', <config/>)
}
</pre>
==Database Pragmas==
=Annotations=
==basex:inlineFunction Inlining==
{{Code|%basex:inline([limit])}} controls if functions will be inlined.
</pre>
==basex:lazyLazy Evaluation==
{{Code|%basex:lazy}} enforces lazy evaluation of a global variable. An example:
The annotation ensures that an error will only be raised if the condition yields true. Without the annotation, the error will always be raised, because the referenced document is not found.
 
==XQuery Locks==
 
{{Mark|Introduced with Version 9.1:}}
 
In analogy with option declarations and pragmas, [[Transactions#XQuery_Locks|XQuery Locks]] can also set via annotations:
 
<pre class="brush:xquery">
declare %basex:write-lock('CONFIGLOCK') function local:write() {
file:write('config.xml', <config/>)
};
</pre>
=Functions=
==Regular expressionsExpressions==
{{Mark|Introduced with Version 9.1:}}
<pre class="brush:xquery">
(: yields "!Hi! !there!" :)
fn:replace('Hi there', '\b', '!', 'j')
</pre>
For more information and some additional BaseX-specific parameters, see the article on [[Serialization]].
=Non-determinismDeterminism=
In [http://www.w3.org/TR/xpath-functions-31/#dt-deterministic XQuery], ''deterministic'' functions are “guaranteed to produce ·identical· results from repeated calls within a single ·execution scope· if the explicit and implicit arguments are identical”. In BaseX, many extension functions are non-deterministic or side-effecting. If an expression is internally flagged as non-deterministic, various optimizations that might change their execution order will not be applied.
=Changelog=
# ;Version 9.1:
* Added: XQuery Locks via pragmas and function annotations.* Added: [[#Regular expressions|Regular Expressions]], {{Code|j}} flag for using Java’s default regex parser.
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu