Hi and thanks, I kind of thought I'd have to do it in some similar way but I wasn't sure... Doesn't it introduce performance problems though? If you do this copying with some bigger chunk of XML does it take the same amount of memory or is it somehow "delta" optimized?
Daniel
-- danielkvasnicka.net
On Nov 22, 2012, at 15:17 , Lukas Kircher lukaskircher1@gmail.com wrote:
Hi Daniel,
- when executing it like this, inside of a closure, nothing happens. No modifications of the database and no errors (%updating missing) either - which is weird. Is this construct supported in 7.5?
I'm not exactly sure about this one - can somebody else help me out here?
- when I remove the sec:secure call and leave only the rest (adding %updating to the declaration) the second insert runs but the first one doesn't - the node is saved without a "id" attribute. Does this have something to do with the PUL order? (http://docs.basex.org/wiki/Update#Example)
Exactly - the example in the documentation explains it all. With the XQUF it is not at all possible to access the changes you introduced in a query within the same query. If you want to do this you could use the [transform expression], which modifies a copy of a given node. Like this:
let $profile := copy $p := json:parse-ml(convert:binary-to-string($data)) modify insert node attribute id { sec:get-current-user-id() } into $p return $p return ( insert node $profile as last into db:open("db")/s:root )
Hope this helps a little ...
Cheers, Lukas
[transform expression] http://docs.basex.org/wiki/Update#transform