【发布时间】:2019-01-09 22:33:31
【问题描述】:
我在代码下方运行,并期望 insert-after 函数在 insert-before 函数之后执行(至少有 2000 毫秒的间隙),因为我的理解是 XQuery 将按顺序执行语句。但是,运行代码后,我看到这两个函数创建的两个文档(/content/testbefore.xml 和 /content/testafter.xml)都有准确的时间戳与毫秒匹配的值。
如何让语句按顺序执行?
xquery version "1.0-ml";
declare function local:insert-before()
{
let $contents :=
<book>
<bookTitle>All About George</bookTitle>
<tstmp>{fn:current-dateTime()}</tstmp>
<chapter1>
<chapterTitle>Curious George</chapterTitle>
</chapter1>
</book>
return xdmp:document-insert("/content/testbefore.xml", $contents)
};
declare function local:insert-after()
{
let $contents :=
<after>
<bookTitle>All About George</bookTitle>
<tstmp>{fn:current-dateTime()}</tstmp>
<chapter1>
<chapterTitle>Curious George</chapterTitle>
</chapter1>
</after>
return xdmp:document-insert("/content/testafter.xml", $contents)
};
local:insert-before(),
xdmp:commit(),
xdmp:sleep(2000),
local:insert-after();
【问题讨论】:
标签: marklogic marklogic-9 marklogic-dhf