db_update()

Purpose

Updates the database

Syntax (CCOWN)

int db_update(int flags)

Syntax (DP4DBAPI)

int dp4_db_update(DCONN * dconn,int flags

Parameters

int flags

Parameter specifying how database is to be updated

 

The parameter flags is a combination of the following values:

 

Value

Meaning

 

COMMIT

Equivalent to calling the function db_commit()

 

CHECKPOINT

Equivalent to calling the function db_checkpoint()

 

FLUSH_LOG

Ensures that the transaction can be recovered if there is a crash.

 

UNLOCK_IF_OK

Unlocks any records only if the update was successful

 

UNLOCK_ALWAYS

Always unlocks any records regardless of the success of the function

 

FAIL_IF_ERROR

If an error occurs, a system error will be generated explaining the reason for the failure, and the program will be terminated.

 

MSGE_IF_ERROR

If an error occurs, a system error message is displayed but the program is not halted

 

CHECK_ONLY

For internal use only

 

UPDATE_ONLY

For internal use only

Description

The db_update() function is used to update the database in the way specified by the parameter flags.

Return values

Returns 0 for success or a value indicating the reason for the failure. See the documentation of the global variable fail_code

The CCOWN version of the API stores the return value of the function in the global variable fail_code.

For each reason for failure there is a corresponding map with number (50 + error_code) in the mapset of the SYSTEM database, (and in the DP4 configuration file errmsg section). If the parameter flags contains either of the values MSGE_IF_ERROR or FAIL_IF_ERROR, this information is displayed. However this will depend on how the application is handling DP4 errors, so in some programs these flags will have no effect.

See also

db_commit(), db_checkpoint()