Loading TOC...

xdmp.rollback

xdmp.rollback() as null

Summary

Roll back the current transaction.

Usage Notes

When a transaction is rolled back, the current statement immediately terminates, updates made by any statement in the transaction are discarded, and the transaction terminates.

Transactions running in "update" or "query" transaction mode should be explicitly rolled back, using this function. Failure to explicitly commit or roll back such a transaction leaves the transaction open until transaction timeout, thus unnecessarily holding resources and locks, potentially blocking other transactions.

Transactions running in "auto" transaction mode may also use this function, to roll back a transaction without raising an error.

The result of a statement terminated with xdmp:rollback is always the empty sequence.

This function is equivalent to calling xdmp:transaction-rollback for the current host and transaction: xdmp:transaction-rollback(xdmp:host(), xdmp:transaction()).

Example

// multi-statement transaction 
declareUpdate({explicitCommit: true});

xdmp.documentInsert("/docs/first.json", {"first": 1});
xdmp.documentInsert("/docs/second.json", {"second": 2});
xdmp.rollback();

  => Empty. The transaction is rolled back. The documents are
     not added to the database. The transaction ends.

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy