D Eloquence Library
The CLOSE Function
The CLOSE funtion terminates access to a database or resets the current record for a data set. The syntax is as follows:
int cc = idb_close(base,dset,mode,status)
int base;
void *dset;
int mode;
int status[10];
The parameters are:
- base
- Identifies the database. This must be the return value from the idb_open call.
- dset
- This parameter is ignored if mode is not equal to 3. Identifies the data set to be rewound. Dset is one of the following:
* a pointer to an integer variable that specifies the data set number;
* a pointer to a 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
- See below.
- status
- A pointer to an array of a least 10 elements used to indicate the success or failure of the function call.
IDBCLOSE Modes
Mode 1. Close database
Terminate access to the database and deallocate resources.
Mode 3. Rewind data set
The current record of the given data set is reset to zero.
Description
Idb_close terminates access to a database or resets current record for a data set. If a program has issued multiple calls to idb_open for the same database, only the access path of the given base parameter is affected.
Idb_close does the following:
- If idb_close is called with mode 1, access to all data sets in the specified database is terminated. Resources allocated for the database are deallocated.
- If idb_close is called with mode 3, the current record for the given data set is reset to zero.
Return value
Returns 0 if successful, or an error number if an error was encountered.
Status codes
If idb_close was successfully executed, the status array will contain the following values:
Status codes
Element | Meaning |
0 | S_OK |
1 | 0 |
2 | 0 |
3 | 0 |
4 | 0 |
5 | DB_CLOSE | (open_mode << 12) |
6 | 0 |
7 | 0 |
8 | mode |
9 | 0 |
Example
if(idb_close(dbid,"CUSTOMER",3,status))
error_handler();
This will rewind CUSTOMER data set.
Eloquence Database Manual - 19 DEC 2002