ML Xquery Transactions

Moderator: Reach-Native-gp

Post Reply
aakashali
Posts: 6
Joined: Mon Jun 08, 2020 10:26 am

ML Xquery Transactions

Post by aakashali »

If a multi-statement transaction has been started and there is no explicit commit written in between, What will happen if the module reaches the end of execution before a commit occurs ?

amitgope
Posts: 4
Joined: Thu Oct 01, 2020 4:10 pm

Re: ML Xquery Transactions

Post by amitgope »

without explicit xdmp:commit(), the code will throw an error and the transaction would fail. For ex,
the following query would fail:

xdmp:document-insert("/testing/ml-transactions1.xml", <testing><test>Transactions in ML</test></testing>),
xdmp:node-insert-after(fn:doc("/testing/ml-transactions1.xml")/testing/test, <test1>Node2</test1>),
fn:doc("/testing/ml-transactions1.xml")

the following query would work fine:

xdmp:document-insert("/testing/ml-transactions1.xml", <testing><test>Transactions in ML</test></testing>),xdmp:commit();
xdmp:node-insert-after(fn:doc("/testing/ml-transactions1.xml")/testing/test, <test1>Node2</test1>),xdmp:commit();
fn:doc("/testing/ml-transactions1.xml")

Post Reply