FLAIM: Transaction Functions

- Main Page
- Modules
- Classes
- Files

# Transaction Functions
[Database Functions]

## Functions
FLMEXP RCODE FLMAPI | FlmDbTransBegin (HFDB hDb, FLMUINT uiTransType, FLMUINT uiMaxLockWait, FLMBYTE *pucHeader=NULL)
| Begin a transaction on the database.
FLMEXP RCODE FLMAPI | FlmDbTransCommit (HFDB hDb, FLMBOOL *pbEmpty=NULL)
| Commit current transaction (if any) on a database.
FLMEXP RCODE FLMAPI | FlmDbTransAbort (HFDB hDb)
| Abort current transaction (if any) on a database.
FLMEXP RCODE FLMAPI | FlmDbGetTransType (HFDB hDb, FLMUINT *puiTransType)
| Get type of current transaction (if any) on a database.
FLMEXP RCODE FLMAPI | FlmDbGetTransId (HFDB hDb, FLMUINT *puiTransID)
| Get current transaction ID.
FLMEXP RCODE FLMAPI | FlmDbGetCommitCnt (HFDB hDb, FLMUINT *puiCommitCount)
| Get number of committed transactions for a database.
FLMEXP RCODE FLMAPI | FlmDbLock (HFDB hDb, eLockType lockType, FLMINT iPriority, FLMUINT uiTimeout)
| Lock a database.
FLMEXP RCODE FLMAPI | FlmDbUnlock (HFDB hDb)
| Unlock a database.
FLMEXP RCODE FLMAPI | FlmDbGetLockType (HFDB hDb, eLockType *pLockType, FLMBOOL *pbImplicit)
| Get the type of lock currently in effect on a database (if any).
FLMEXP RCODE FLMAPI | FlmDbCheckpoint (HFDB hDb, FLMUINT uiTimeout)
| Perform a checkpoint on the database.

## Function Documentation

FLMEXP RCODE FLMAPI FlmDbCheckpoint | ( | HFDB | hDb,
|  | FLMUINT | uiTimeout
| ) |

  | Perform a checkpoint on the database. Parameters:
  hDb | Database handle.
  uiTimeout | Specifies the maximum number of seconds to wait to obtain the database lock. An exclusive lock must be obtained to do a checkpoint. NOTE: A value of FLM_NO_TIMEOUT specifies that it should wait forever - until the lock becomes available.

FLMEXP RCODE FLMAPI FlmDbGetCommitCnt | ( | HFDB | hDb,
|  | FLMUINT * | puiCommitCount
| ) |

  | Get number of committed transactions for a database. Parameters:
  hDb | Database handle.
  puiCommitCount | Number of transactions that have been committed is returned here.

FLMEXP RCODE FLMAPI FlmDbGetLockType | ( | HFDB | hDb,
|  | eLockType * | pLockType,
|  | FLMBOOL * | pbImplicit
| ) |

  | Get the type of lock currently in effect on a database (if any). Parameters:
  hDb | Database handle.
  pLockType | Type of lock currently held returned here.
  pbImplicit | Flag indicating if the lock is an implicit lock. An implicit lock is one that FLAIM obtained automatically when it started an update transaction. An implicit lock will be released automatically when the transaction commits or aborts. An explicit lock is one which was obtained by calling FlmDbLock(). An explicit lock is released when the application calls FlmDbUnlock().

FLMEXP RCODE FLMAPI FlmDbGetTransId | ( | HFDB | hDb,
|  | FLMUINT * | puiTransID
| ) |

  | Get current transaction ID. Parameters:
  hDb | Database handle.
  puiTransID | Current transaction ID is returned here. If no transaction is currently active, the function will return RCODE::FERR_NO_TRANS_ACTIVE.

FLMEXP RCODE FLMAPI FlmDbGetTransType | ( | HFDB | hDb,
|  | FLMUINT * | puiTransType
| ) |

  | Get type of current transaction (if any) on a database. Parameters:
  hDb | Database handle.
  puiTransType | Transaction type is returned here. It will be one of the following: FLM_NO_TRANS - No transaction currently active on this database handle FLM_UPDATE_TRANS - Update transaction is active on this database handle FLM_READ_TRANS - Read transaction is active on this database handle

FLMEXP RCODE FLMAPI FlmDbLock | ( | HFDB | hDb,
|  | eLockType | lockType,
|  | FLMINT | iPriority,
|  | FLMUINT | uiTimeout
| ) |

  | Lock a database. Parameters:
  hDb | Database handle.
  lockType | Type of lock being requested.
  iPriority | Priority of lock being requested.
  uiTimeout | Specifies the maximum number of seconds to wait to obtain the lock. NOTE: A value of FLM_NO_TIMEOUT specifies that it should wait forever - until the lock becomes available.

FLMEXP RCODE FLMAPI FlmDbTransAbort | ( | HFDB | hDb | ) |

  | Abort current transaction (if any) on a database. Parameters:
  hDb | Database handle.

FLMEXP RCODE FLMAPI FlmDbTransBegin | ( | HFDB | hDb,
|  | FLMUINT | uiTransType,
|  | FLMUINT | uiMaxLockWait,
|  | FLMBYTE * | pucHeader = `NULL`
| ) |

  | Begin a transaction on the database. Parameters:
  hDb | Database handle.
  uiTransType | Type of transaction to start. May be FLM_UPDATE_TRANS or FLM_READ_TRANS. The following flags may also be ORed into the transaction type to get special behaviors during the transaction: FLM_DONT_KILL_TRANS - Marks a read transaction as one that cannot be killed by FLAIM. FLAIM will occasionally be forced to kill a long-running read transaction so that a checkpoint can be finished. It is NOT recommended that applications use this flag FLM_DONT_POISON_CACHE - Marks the transaction so that any items the transaction brings into cache (records or blocks) will not poison cache. That is, they will not be allowed to replace other items. If an application has a transaction that is going to read through all of the records in the database, it would probably be wise to set this flag - so that it won't poison cache. However, generally it is not necessary to set this flag
  uiMaxLockWait | Only applicable for update transactions. Specifies the maximum number of seconds to wait to obtain the database lock. NOTE: A value of FLM_NO_TIMEOUT specifies that it should wait forever - until the lock becomes available.
  pucHeader | If non-NULL, the entire log header is returned in this buffer. The buffer should be at least F_TRANS_HEADER_SIZE bytes.

FLMEXP RCODE FLMAPI FlmDbTransCommit | ( | HFDB | hDb,
|  | FLMBOOL * | pbEmpty = `NULL`
| ) |

  | Commit current transaction (if any) on a database. Parameters:
  hDb | Database handle.
  pbEmpty | If non-NULL, this returns a flag indicating whether or not the transaction was empty. This is only returned for update transactions. If TRUE, it means that no updates were performed inside the transaction, and hence, the transaction was not logged to the roll-forward log. Furthermore, the transaction ID and the count of committed transactions will not have been altered. In short, it will be as if the transaction never happened.

FLMEXP RCODE FLMAPI FlmDbUnlock | ( | HFDB | hDb | ) |

  | Unlock a database. Parameters:
  hDb | Database handle.