私はコードの下で実行しており、関数が関数のinsert-after
後に実行されることを期待していinsert-before
ます (少なくとも 2000 ミリ秒のギャップがあります)。私の理解では、XQuery はステートメントを順番に実行するということです。しかし、コードを実行すると、2 つの関数によって作成された両方のドキュメント ( /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();