db_checkpoint()

Purpose

Writes and flushes all outstanding updates to the database

Old name

#define checkpoint() (db_checkpoint()==0)

Syntax (CCOWN)

int db_checkpoint(void);

Syntax (DP4DBAPI)

int dp4_db_checkpoint(DCONN * dconn);

Description

This function commits the current transaction like db_commit(), but in addition it guarantees that the transaction log file is flushed, and that therefore the transaction is recoverable. If the operation is successful, all records locked by the calling process are unlocked.

If the system crashes, the transactions up to the last successful checkpoint() are guaranteed to be recoverable. If the function db_commit() is used instead, the last few transactions may be lost,(but it is guaranteed that there will be no partial transactions).

Return values

Returns 0 if the commit succeeds or and error code indicating the reason for failure. The CCOWN API stores the return value in the global variable fail_code

See also

db_commit(), rec_post_with_flags(), db_decommit(), db_update()