Loading TOC...

xdmp:set-transaction-mode

xdmp:set-transaction-mode(
   $value as xs:string
) as empty-sequence()

Summary

Set the transaction mode for the current session. Calling this function has no effect on existing transactions.

Parameters
value The new transaction mode. Must be one of "auto", "query", "update", "query-single-statement", "update-auto-commit", and "multi-auto".

Usage Notes

The mode a transaction runs under is fixed when the transaction is created. Calling xdmp:set-transaction-mode during a query does not affect the current transaction.

The transaction mode defaults to "auto". To change the mode, you may either call xdmp:set-transaction-mode or use the xdmp:transaction-mode option.

Use the xdmp:transaction-mode option to set the transaction mode before a transaction exists. Use xdmp:set-transaction-mode to set the mode during execution.

Example

declare option xdmp:transaction-mode "update";

  (: this transaction runs in update mode, due to the option :)
xdmp:set-transaction-mode("query"),
xdmp:document-insert("/docs/mydoc.xml", <myData/>),
xdmp:commit();

  (: but this new transaction runs in query mode :)
xdmp:get-transaction-mode(),
fn:doc("/docs/mydoc.xml")

=> "query"
   <myData/>

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.