xdmp:commit() as empty-sequence()
Commit the current transaction to the database.
Transactions running in "update" or "query" transaction mode must be
explicitly committed, using this function. xdmp:commit
is a no-op in "auto" transaction mode (the default) because
auto-commit transactions automatically commit at the end of
every statement.
When you call xdmp:commit
, the transaction is marked for
commit, but commit does not actually happen until the end of the
currently executing statement.
This function is equivalent to calling
xdmp:transaction-commit
for the current host and transaction:
xdmp:transaction-commit(xdmp:host(), xdmp:transaction())
.
xdmp:set-transaction-mode("update"), xdmp:document-insert("/docs/mydoc.xml", <myData/>), xdmp:commit() => Empty. The current transaction is marked ready to be committed. When the commit completes, the document is visible in the database, and the transaction ends.