Changes

Jump to navigation Jump to search
2 bytes added ,  20:55, 19 July 2022
no edit summary
'factbook',
map:merge(
for $country in db:openget('factbook')//country
return map:entry($country/@name, $country//city/name ! string())
),
<syntaxhighlight lang="xquery">
declare variable $n external;
db:openget('names-' || $n)
</syntaxhighlight>
After the query has been parsed, a user-specific value (e.g., {{Code|123}}) will be bound to {{Code|$n}}. The variable will be inlined by the compiler, and the argument of {{CodeFunction||db:openget}} will be pre-evaluated to {{Code|names123}}. It is then easy for the lock detector to collect the name of the database that needs to read-locked before the query is eventually executed.
Another positive side effect of two-step compilation is that productive environments get faster in general: Queries can be compiled in parallel, and it’s only the optimization and evaluation of a query that may need to be delayed by locking.
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu