Changes

Jump to navigation Jump to search
No change in size ,  14:42, 8 December 2010
no edit summary
This article aims to provide a very quick and basic introduction to the XQUF. First are some examples for new expressions and useful information for each of them.
After that a few problems are solved that arise frequently due to the special nature of the language. Some of them are stated in the [[Update#XQUF Concepts|Concepts]] section.
 
==XQUF Concepts==
There are a few specialties around XQuery Update that you should know about. In addition to the <b>simple expression</b>, the XQUF adds the <b>updating expression</b> as a new type of expression. An updating expression is able to change the state of a database node, whereas a simple expression cannot perform any permanent changes.
 
===Pending Update List===
The most important thing to keep in mind when using XQuery Update is the Pending Update List (PUL). In contrast to other programming languages, XQUF statements are not executed immediately, but are first collected within a set-like structure, the PUL. At the end of a query, all update primitives on this list are applied after being checked for compatibility. If a conflict exists, an error message is returned and all accessed databases remain untouched (atomicity). For the user this means updates are only visible <b>after</b> the end of a snapshot.
 
===Returning Results===
It is not possible to mix different types of expressions in a query result. The outermost expression of a query must either be a collection of updating or non-updating expressions. Generally there is no way to perform any updating queries and return a result at the same time. But a simple and convenient workaround exists. common error: copy/fragment of dbnode-> change for result. better use transform
 
===Function Declaration===
To use updating expressions within a function, the 'updating' flag has to be added to the function declaration. A correct declaration of a function that contains updating expressions (or a function that calls updating functions) looks like this: declare <b>updating</b> function { ... }
==New Functionality==
====fn:put()====
FN:put() is also part of the XQUF and enables the user 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.
 
==XQUF Concepts==
There are a few specialties around XQuery Update that you should know about. In addition to the <b>simple expression</b>, the XQUF adds the <b>updating expression</b> as a new type of expression. An updating expression is able to change the state of a database node, whereas a simple expression cannot perform any permanent changes.
 
===Pending Update List===
The most important thing to keep in mind when using XQuery Update is the Pending Update List (PUL). In contrast to other programming languages, XQUF statements are not executed immediately, but are first collected within a set-like structure, the PUL. At the end of a query, all update primitives on this list are applied after being checked for compatibility. If a conflict exists, an error message is returned and all accessed databases remain untouched (atomicity). For the user this means updates are only visible <b>after</b> the end of a snapshot.
 
===Returning Results===
It is not possible to mix different types of expressions in a query result. The outermost expression of a query must either be a collection of updating or non-updating expressions. Generally there is no way to perform any updating queries and return a result at the same time. But a simple and convenient workaround exists. common error: copy/fragment of dbnode-> change for result. better use transform
 
===Function Declaration===
To use updating expressions within a function, the 'updating' flag has to be added to the function declaration. A correct declaration of a function that contains updating expressions (or a function that calls updating functions) looks like this: declare <b>updating</b> function { ... }
==Effects on Your Documents==
administrator, Bureaucrats, editor, reviewer, Administrators
408

edits

Navigation menu