D Eloquence Library

The OPEN Function

The OPEN function initiates access to a database.

Status Codes

   int dbid = idb_open(base,passwd,mode,status)

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

base
Specifies the database to be opened. Base is a pointer to a character array containing up to 256 characters (bytes). The database name must be terminated with a '\0' character.
passwd
A pointer to a character array containing the password. If the password is less than 16 characters long, it must be terminated by a semicolon, a blank or a '0' character. The password establishes the security class number which defines the data sets and data items to which the calling program has read, update and/or write access.
The password is only used when connecting an eloqdb5 server. With eloqdb6, the password is ignored and authorization information is passwd with idb_logon().
mode
Specifies type of database access. See 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).

IDBOPEN Modes

Mode 1: Modify shared

Data entries can be read, updated, added or deleted. This mode can be used if all concurrent users have opened the database in either mode 1 or mode 9.

Mode 3: Modify exclusive

Data entries can be read, updated, added or deleted. This mode can be used only if the database is not already opened by another user.

Mode 8: Read shared, only concurrent read allowed

Data entries can only be read. Updating, adding or deleting are not permitted by this user or any other user. This mode can be used only if all concurrent users have opened the database in either mode 8 or mode 9.

This mode allows you to access the database even if the database is recognized to be inconsistent.

Mode 9: Read shared

Data entries can only be read. Updating, adding or deleting are not permitted by this user. This mode can be used only, if all concurrent users have opened the database in mode 1, mode 8 or mode 9.

Description

idb_open initiates access to a database, establishes the security class number of the calling program, and establishes the type of access for all subsequent operations on the database.

The password parameter is not checked if user is the superuser (root).

Return value

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

Status codes

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

Status codes
ElementMeaning
0S_OK
1user class
20
30
40
5DB_OPEN | (open_mode << 12)
60
70
8mode
9database id

Example

   if((dbid = idb_open("SAD","MANAGER",1,status)) %< 0) {
      printf("unable to open SAD database\\n");
      exit(1);
   }
This will open database SAD.


Eloquence Database Manual - 19 DEC 2002