D Eloquence Library

The BEGIN Function

The BEGIN function begins a new (sub-) transaction . The syntax is as follows:

   idb_begin(comment,mode,status)

   char *comment;
   int mode;
   int status[10]
The parameters are:

comment
A pointer to a character array providing a comment for the transaction. It must be terminated with a 0 character. This comment is stored by the database server in the transaction log. When a NULL pointer is passed or the comment is empty the value is ignored.
mode
Must be 1.
status
A pointer to an array of a least 10 elements used to indicate the success or failure of the function call (see below).

Description

The idb_begin function begins a new (sub-) transaction. When this is the first transaction, it is called top level transaction. No modifications are permanently saved in the Eloquence A.06.00 data base until the top level transaction is committed. A subsequent idb_begin function call begins a new subtransaction, which can be controlled separately with idb_commit and idb_rollback functions.

Each transaction gets a transaction identifier assigned, which is unique during the database session. This is returned in the status. If a comment is passed to idb_begin, the string is written to the database transaction log..

Return value

Returns 0 if successful, or error number if an error was encountered.

Status codes

If idb_begin was successfully executed, the status array will contain the following values:

Status codes
ElementMeaning
0S_OK
1Transaction ID
2Transaction nesting level
30
40
50
60
70
80
90

Example

   if(idb_begin(NULL,1,status))
      error_handler();
This will begin a new transaction.


Eloquence Database Manual - 19 DEC 2002