Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic


Maintain a single moving save point within a transaction.


NINT ctdbSetSingleSavePoint(CTHANDLE Handle)


ctdbSetSavePoint() establishes a transaction save point.

  • Handle [in] the session handle.

Call ctdbSetSingleSavePoint() to establish a savepoint while at the same time clearing the previous savepoint. ctdbSetSingleSavePoint() can be used to maintain a single "moving" savepoint within a transaction, which is useful for applications that may need to undo the work since the last savepoint but that never need to restore back to a point prior to the most recent savepoint. ctdbSetSingleSavePoint() provides this ability in the form of a single savepoint rather than multiple savepoints. Because ctdbSetSingleSavePoint() clears the previous savepoint, only the most recently established savepoint can be restored to. To restore to this savepoint, call ctdbRestoreSavePoint().


ctdbSetSingleSavePoint() returns a non-zero value to indicate success and a value of zero to indicate failure. If the return value is zero, uerr_cod contains the c-tree error code. If a client supports ctdbSetSingleSavePoint() and the server does not, the message:

"Bad raw function #. fn: 231"

will be placed in CTSTATUS.FCS and the c-tree error SFUN_ERR (170) will be returned. A ctdbRestoreSavePoint() cannot go back beyond a special save point set with ctdbSetSingleSavePoint(). Further, ctdbClearSavePoint() cannot clear a special save point. Either of these situations returns a SPCL_ERR (753).

See also

ctdbAbort(), ctdbBegin(), ctdbClearSavePoint(), ctdbCommit(), ctdbRestoreSavePoint()