Classification: Public
Hi Danny,
You can end the transaction with semi colon. Then in the same x-query, access
the document and return it.
For ex.
(: This is the first transaction where update happens:)
declare variable $uri as xs:string := "/doc/sample.xml";
let $doc := fn:doc($uri)
return xdmp:node-replace($doc/update-node, element new-node { "new text"})
;
(:This is the second transaction where you can read the changes from first
transaction :)
(: Variables, imports, namespaces must be defined again here.:)
declare variable $uri as xs:string := "/doc/sample.xml";
fn:doc($uri)
From: [email protected]
[mailto:[email protected]] On Behalf Of Danny Sinang
Sent: Friday, March 27, 2015 11:54 AM
To: general
Subject: [MarkLogic Dev General] How to display updated document right after
update query
I've an update query that replaces a node within a document.
The node replacement works, but the requirement is for the same query to return
the contents of the updated document.
I know this isn't normally possible since the update query doesn't do a commit
till after the query is executed.
Anybody know of a workaround for this ?
Regards,
Danny
---
This communication may contain confidential and/or privileged information. If
you are not the intended recipient (or have received this communication in
error) please notify the sender immediately and destroy this communication. Any
unauthorized copying, disclosure or distribution of the material in this
communication is strictly forbidden.
Deutsche Bank does not render legal or tax advice, and the information
contained in this communication should not be regarded as such.
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general