===XQuery===
With {{Announce|Version Since BaseX 10}}, the [[BaseX 10#Compilation|lock detection has been fundamentally improved]], by splitting compilation into multiple steps.
Local locks can be applied if it is possible after compile time to associate all database operations with static databases names:
In the following module, lock annotations are used to prevent concurrent write operations on the same file:
<syntaxhighlight pre lang="'xquery"'>
module namespace config = 'config';
file:write-text('config.txt', $data)
};
</syntaxhighlightpre>
Some explanations:
Locks can also be declared via pragmas:
<syntaxhighlight pre lang="'xquery"'>
update:output((# basex:lock CONFIG #) {
file:write('config.xml', <config/>)
})
</syntaxhighlightpre>
The write locks is enforced via the {{Code|Update|update:output}}.
Locks for the functions of a module can also be assigned via option declarations:
<syntaxhighlight pre lang="'xquery"'>
declare option basex:lock 'CONFIG';
update:output(file:write('config.xml', <config/>))
</syntaxhighlightpre>
Once again, a write lock is enforced.