Changes

Jump to navigation Jump to search
405 bytes added ,  16:31, 30 November 2015
no edit summary
==Updating Expressions==
 
There are five new expressions to modify data. While {{Code|insert}}, {{Code|delete}}, {{Code|rename}} and {{Code|replace}} are basically self-explanatory, the {{Code|transform}} expression is different, as modified nodes are copied in advance and the original databases remain untouched.
==Functions==
===fn:put=Built-in Functions==
{{Code|fn:put()}} is also part of the XQUF and enables the user can be used to serialize XDM instances to secondary storage. It is executed at the end of a snapshot. Serialized documents therefore reflect all changes made effective during a query.
===Additional [[Database Functions===Module#Updates|database functions]] exist for performing updates on document and database level.
Some additional==User-Defined Functions== To use updating expressions within a user-defined or anonymous function, the {{Code|%updating [[Database Module#Updates}} annotation has to be added before the {{Code|database function}} keyword. A correct declaration of a function that contains updating expressions (or one that calls updating functions]] exist in order to ) looks like this:  <pre class="brush:xquery">declare %updating function { ... }</pre> If an updating function item is called, the function call must be prefixed with the keyword {{Code|updating}}. This ensures that the query compiler can statically detect if an invoked function item will perform updates on document and database levelor not: <pre class="brush:xquery">let $node := <node>TO-BE-DELETED</node>let $delete-text := %updating function($node) { delete node $node//text()}return $node update ( updating $delete-text(.))</pre>
=Concepts=
 
There are a few specialties around XQuery Update that you should know about. In addition to the '''simple expression''', the XQUF adds the '''updating expression''' as a new type of expression. An updating expression returns only a Pending Update List (PUL) as a result which is subsequently applied to addressed databases and DOM nodes. A simple expression cannot perform any permanent changes and returns an empty or non-empty sequence.
If you want to modify nodes in main memory, you can use the [[Update#transform|transform expression]].
 
==Function Declaration==
 
To use updating expressions within a function, the {{Code|%updating}} annotation has to be added to the function declaration. A correct declaration of a function that contains updating expressions (or one that calls updating functions) looks like this:
 
<pre class="brush:xquery">
declare %updating function { ... }
</pre>
==Effects==
Bureaucrats, editor, reviewer, Administrators
12,258

edits

Navigation menu