Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbSetAutoCommit

Sets the c-treeDB API auto commit mode.

Declaration

CTDBRET ctdbDECL ctdbSetAutoCommit(CTHANDLE Handle, CTBOOL flag);

Description

ctdbSetAutoCommit() sets the c-treeDB API auto commit mode. The auto commit of transactions are invoked automatically when records are added or updated by a ctdbWriteRecord() call. Automatic transactions may increase performance by reducing network traffic for single record updates since this is equivalent of performing the following functions:

ctdbBegin();

if (ctdbWriteRecord() == CTDBRET_OK)

ctdbCommit();

else

ctdbAbort();

  • Handle is a session handle.
  • flag indicates if auto commit mode should be enabled or not.

The following apply when an automatic transaction is performed:

  • An automatic transaction will only free locks acquired by the ctdbWriteRecord() function.
  • If an automatic transaction is aborted because of errors detected by ctdbWriteRecord(), all locks acquired by ctdbWriteRecord() are released.
  • If locks are active, by calling ctdbLock() function, an automatic transaction will not release any locks when it commits or aborts the ctdbWriteRecord() operation.
  • If OPS_UNLOCK_UPD is on, both commits and aborts on automatic transactions release only locks obtained within trans and/or locks on records updated within transaction, regardless if the c-treeDB API session lock state is active or not.

Return Values

Value

Symbolic Constant

Explanation

0

CTDBRET_OK

No Error

See Also

ctdbGetAutoCommit() ctdbSetOperationState() ctdbGetOperationState()

TOCIndex