Changes

Jump to navigation Jump to search
42 bytes added ,  14:54, 16 May 2023
===User-Defined Functions===
If an updating function item is called, the function call must Functions that performs updates need to be prefixed marked with the an {{Code|%updating}} keyword. This ensures that the query compiler can statically detect whether an invoked function item will perform updates or notannotation:
<syntaxhighlight lang="xquery">
let $node := <node>TO-BE-DELETED</node>let $delete-text := declare %updating functionlocal:add($target, $node) { delete insert node $node into $target}; <node/> update { local:add(., <sub/text(>)
}
</syntaxhighlight> If update operations are defined in an anonymous function, it may be necessary to call the function with an additional {{Code|updating}} keyword: <syntaxhighlight lang="xquery">let $add := %updating function($target, $node) { insert node $node into $target}return $<node /> update { updating $delete-textadd(., <sub/>)
}
</syntaxhighlight>
 
As shown in the example, user-defined and anonymous functions can additionally be annotated as {{Code|%updating}}.
=Concepts=
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu