Skip to content

Instantly share code, notes, and snippets.

@ableasdale
Created November 29, 2012 19:40
Show Gist options
  • Save ableasdale/4171340 to your computer and use it in GitHub Desktop.
Save ableasdale/4171340 to your computer and use it in GitHub Desktop.
Inserting content using xdmp:eval for isolated (separate) transctions
xquery version "1.0-ml";
declare namespace prop="http://marklogic.com/xdmp/property";
declare variable $doc-count as xs:int := 10;
for $item in (1 to $doc-count)
let $eval := "xquery version '1.0-ml';
declare variable $count as xs:string external;
xdmp:document-insert(fn:concat('/test/', $count, '.xml'), element root{ $count })"
return
(
xdmp:eval($eval, (xs:QName("count"), fn:string($item))),
xdmp:sleep(1000)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment