Changes

Jump to navigation Jump to search
1,047 bytes added ,  16:10, 20 February 2018
=Pragmas=
[[Options|Local database options]] ==BaseX Pragmas== Many optimizations in BaseX will only be performed if an expression is ''deterministic'' (i. e., if it always yields the same output and does not have side effects). By flagging an expression as non-deterministic, optimizations and query rewritings can be assigned locally via pragmassuppressed:
<pre class="brush:xquery">
sum( (# dbbasex:chop false non-deterministic #) { doc('doc.xml' 1 to 100000000}) }
</pre>
Various optimizations This pragma can be disabled by marking an expression as non-deterministichelpful when debugging your code. ==Database Pragmas== All [[Options|local database options]] can be assigned via pragmas. Some examples: * {{Version|9.0}}: Enforce query to be rewritten for index access. This can e. g. be helpful if the name of a database is not static (see [[Indexes#Enforce Rewritings|Enforce Rewritings]] for more examples):
<pre class="brush:xquery">
count( # db:enforceindex #) { for $db in ('persons1', 'persons2', 'persons3') return db:open($db)//name[text() = 'John']}</pre> * {{Version|9.0}}: Temporarily disable node copying in node constructors (see {{Option|COPYNODE}} for more details). The following query will be evaluated faster, and take much less memory, than without pragma, because the database nodes will not be fully copied, but only attached to the new {{Code|xml}} parent element: <pre class="brush:xquery">file:write( 'wrapped-db-nodes.xml', (# basexdb:non-deterministic copynode false #) { 1 to 10 <xml>{ db:open('huge') }</xml> })
</pre>
=Annotations=
 
The following implementation-defined annotations are available:
==basex:inline==
</pre>
By default, XQuery functions will be ''inlined'' if the query body is not too large and does not exceed the value assigned to a fixed number of expressions, which can be adjusted via the {{Option|INLINELIMIT}} option.
The annotation can be used to overwrite this global limit: Function inlining can be enforced if no argument is specified. Inlining will be disabled if {{Code|0}} is specified.
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu