D Eloquence Library

The UNLOCK Function

The UNLOCK function unlocks a database. The syntax is as follows:

   int cc = idb_unlock(base,qual,mode,status)

   int base;
   void *qual;
   int mode;
   int status[10];
The parameters are:

base
Identifies the database. This must be the return value from the idb_open call
qual
This parameter is ignored.
mode
The modes available listed below.
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:

Idb_unlock is used to release data base locks. 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_unlock modes
Mode Target Description
1databaseUnlock database. All locks for the database are released.
3data setUnlock data set. A lock mode 3/4/13/14 for the specified data set is released.
5predicateUnlock predicate. A lock mode 5/6/15/16 is released.. The qualifier must match the idb_lock qualifier argument.

In addition to the "official" modes above, idb_unlock also accepts and translates the following mode values:

Mode 2/11/12 is mapped to 1

Mode 4/13/14 is mapped to 3

Mode 6/15/16 is mapped to 5

This makes it possible to use the same idb_lock and idb_unlock modes.

Return value

Returns 0 if successful, otherwise error code.

Status codes

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

Status codes
ElementMeaning
0S_OK
1unchanged
2unchanged
3unchanged
40
5DB_UNLOCK | (open_mode << 12)
60
70
8mode
90

Example

   if(idb_unlock(dbid,"",1,status))
      error_handler();
This will release all locks for given database.


Eloquence Database Manual - 19 DEC 2002