Product Documentation

c-treeDB API for C# - Developers Guide

Previous Topic

Next Topic

CTBase.SetAutoCommit

Declaration

void CTBase.SetAutoCommit(CTBOOL flag);

Description

SetAutoCommit() sets the auto commit mode.

  • flag indicates if auto commit mode should be enabled or not.

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

hRecord.Begin();

try

{

hRecord.Write();

hRecord.Commit();

}

catch (CTException)

{

hRecord.Abort();

}

The following applies when an automatic transaction is performed:

  1. An automatic transaction will only free locks acquired by the CTRecord.Write() function.
  2. If an automatic transaction is aborted because of errors detected by CTRecord.Write() all locks acquired by CTRecord.Write() are released.
  3. If locks are active, by calling CTBase.Lock() function, an automatic transaction will not release any locks when it commits or aborts the CTRecord.Write() operation.
  4. 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 .NET session lock state is active or not.

Return Values

Value

Symbolic Constant

Explanation

0

CTDBRET_OK

No Error

See Also

CTBase.GetAutoCommit() CTBase.SetOperation() CTBase.GetOperation()

TOCIndex