Changes

Jump to navigation Jump to search
301 bytes added ,  15:02, 18 August 2017
* A {{Option|FAIRLOCK}} option has been added: By default, read transactions will now be favored, and transactions that access no databases can be evaluated even if the transactions limit has been reached.
==External Side EffectsXQuery Locks==
Access By default, access to external resources (files on hard disk, HTTP requests, ...) is not controlled by the transaction monitor of BaseX unless specified by the user.You can use custom XQuery locks to do so:
===XQuery Locking Query Options===
Custom * The locks can be acquired by setting the BaseX-specific XQuery are declared as options {{Code|query:read-lock}} and {{Code|query:write-lock}}in the query prolog. * Multiple option declarations may occur can be specified in the prolog of a querymodule, but multiple or values can also be separated with commas in a single declaration. These * XQuery locks are in another a separate namespace than , such that there will be no conflicts with the internal database names: the lock value {{Code|factbook}} will not lock a database named factbooklocks.* Similar to internal locks, write locks block all other operations while read locks allow parallel access.
These option declarations will put read locks on ''foo''In the following module, ''bar'' and ''batz'' and a write lock on ''quix''is declared to avoid multiple clients writing to a config file at the same time:
<pre class="brush:xquery">
module namespace config = 'config'; (:~ Write lock for all functions of the module. :)declare option query:readwrite-lock "foo,barfiles";(:~ Config file. :)declare option queryvariable $config:file := 'config.txt'; declare function config:write($config) { file:readwrite-lock "batz"text($config:file, $config)}; declare option queryfunction config:read() { file:writeread-lock "quix"text($config:file)};
</pre>
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu