D Eloquence Library

The UPDATE Function

The UPDATE function updates an entry in the database. The syntax is as follows:

   idb_update(base,dset,mode,status,list,buf)

   int base;
   void *dset;
   int mode;
   int status[10]
   void *list;
   void *buffer;
The parameters are:

base
Identifies the database. This must be the return value from the idb_open call
dset
Identifies the data set in which the entries are to be located. Dset is one of the following:
* a pointer to an integer variable that specifies the data set number

* a pointer to an character array containing up to 16 characters (bytes) that specifies the data set name. The data set name must be terminated with a semicolon, a blank or \0 character if it is less than 16 characters.

mode
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).
list
Usually specifies the data items for which values are to be retrieved from the buffer parameter and stored in the dataset. @ is the only character supported as list parameter, i.e. a value for every data item in the entry will be returned (in the order defined in the data set). list must be a pointer to a character array.
buffer
A pointer to a character array containing new values for all data items in the data set.

Description

Idb_update updates current entry of the specified data set. The database must be open in either mode 1 or mode 3. The security class number must have write access to the data set specified in dset.

Search item values may not be changed.

If index items are defined for the specified data sets, the index entries are automatically maintained.

Return value

Returns 0 if successful, otherwise error code.

Status codes

If idb-update was successfully executed, the status array will contain the following values:

Status codes
ElementMeaning
0S_OK
1record length
20
3record number
40
50 if detail set, 1 if master set
60
7backward address
80
9forward address

Example

   if(idb_update(dbid,"CUSTOMER",1,status,"@",buf))
      error_handler();
This will update current record in the CUSTOMER data set.


Eloquence Database Manual - 19 DEC 2002