Changes

Jump to navigation Jump to search
1,797 bytes added ,  11:35, 12 December 2017
Created page with "This XQuery Module adds updating functions. =Conventions= All functions in this module are assigned to the <code><nowiki>http://basex.org/modules/update</now..."
This [[Module Library|XQuery Module]] adds updating functions.

=Conventions=

All functions in this module are assigned to the <code><nowiki>http://basex.org/modules/update</nowiki></code> namespace, which is statically bound to the {{Code|update}} prefix.<br/>

=Functions=

==update:output==

{{Mark|Updated with Version 9.0}}: formerly {{Code|db:output}}.

{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|update:output|$result as item()*|empty-sequence()}}
|-
| '''Summary'''
|This function can be used to both perform updates and return results in a single query. The argument of the function will be evaluated, and the resulting items will be cached and returned after the updates on the ''pending update list'' have been processed. As nodes may be updated, they will be copied before being cached.<br/>The function can only be used together with [[XQuery Update#Updating Expressions|updating expressions]]; if the function is called within a transform expression, its results will be discarded.
|-
| '''Examples'''
|
* {{Code|update:output("Prices have been deleted."), delete node //price}} deletes all {{Code|price}} elements in a database and returns an info message.
|}

==update:output-cache==

{{Mark|Updated with Version 9.0}}: formerly {{Code|db:output-cache}}.

{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|update:output-cache||item()*}}
|-
| '''Summary'''
|Returns the items that have been cached by [[#update:output|update:output]]. It can be used to check which items will eventually be returned as result of an updating function.<br/>This function is ''non-deterministic'': It will return different results before and after items have been cached. It is e. g. useful when writing [[Unit Module|unit tests]].
|}

=Changelog=

Added with Version 9.0.
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu