xml - xdmp:eval and Update transactions -


i have test case here:

let $s :=  'xquery version "1.0-ml"; $doc in xdmp:directory("/test/")               return               xdmp:node-insert-child(doc(xdmp:node-uri($doc))/a,     <b>bbb</b>) return (xdmp:eval($s, (), <options xmlns="xdmp:eval">       <isolation>different-transaction</isolation>       <prevent-deadlocks>true</prevent-deadlocks>     </options>), xdmp:directory("/test/")) 

my main goal here add new element each document in "/test/" , return results in same transaction. xdmp:eval() , "different-transaction" option thought eval-ed code executed in separate transaction updates available subsequent calls... 2nd , last xdmp:directory("/test/") should returning updated documents <b> element, yet returns non-updated documents.

were there caveats here xdmp:eval , i'm trying achieve in single transaction?

marklogic 8 in case, idea update in function invoked main script. settings used not commit doc, expose the new commit initial code. because of how marklogic handles timestamps in code, because may committed not mean available code. why? because timestamp of commit after code started run (or that). approach solves that. also, chose marklogic 8 example because original question did not scope previous release. went solution current version of marklogic.

xquery version "1.0-ml";  (: load docs  $foo in (1 5)   let $uri := "/test/child/foo" || xs:string($foo) || ".xml"   return xdmp:document-insert($uri, <foo><bar></bar></foo>) :)    let $update := xdmp:invoke-function(function(){     (for $uri in cts:uri-match("/test/child/foo*")       return xdmp:node-insert-child(doc($uri)/foo/bar, <baz>bbb</baz>)       ,xdmp:commit()     )   },   <options xmlns="xdmp:eval">       <transaction-mode>update-auto-commit</transaction-mode>       <isolation>different-transaction</isolation>     </options> )  return xdmp:directory("/test/child/") 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -