ARGUMENTS dbnames Semi-colon separated list off names of the databases to be opened.
type String containing the type of access to the database.
DESCRIPTION This function opens the databases identifed in the string pointed to be dbnames. If more than one database is to be opened, the names are separated in the list by semi-colons (';'). No white space (i.e. space, tabs, ets.) should be embedded in the string. The type of access to all of the databases is specified by the string type as follows:
Type Description
"s" Shared access mode. Multiple can be accessing database at the same time
"x" Exclusive access mode. Only one user can access the database. All others will be locked out.
"o" One user only mode. Only one user will be using specified database. ────────────────────────────────────────────────────────────────────────── Note: The single_user version of db_VISTA does not require the type parametr. ────────────────────────────────────────────────────────────────────────── Each database name can include a pach name of the directory which contains the dictionary and database files. Note that the specified pach will overide use of the DBDPACH and DBFPACH enviroment variables for that database.
If multiple databases are being opened, the databases are assigned sequentional numbers left to right in the order specified in the list with the first being zero. The current database will be set to zero (i.e. the first in the XXXX upon return from the call. The database number is either passed to function d_setbd or each database access function to set the current database when multiple databases have been opened.
db_VISTA's processing of a d_open call is quite involved and basically consist of dynamically allocating and initializing the memory required for the dictionary, currency tables, key processing tables, virtual memory cache, and lock control tables (in sharred mode). An inter-process communication sessions is initiated with the lock manager and the names of the database files to be used by the program are sent to lock manager. If there are no other databases open on the system, the transaction activity file is checked to see if recovery needs to be performed. The transaction log file is then initialized.
CURRENCY CHANGES curr_rec = system record (or NULL_DBA, if no system record);
curr_own[system owned sets] = system record;
curr_own[all other sets] = NULL_DBA;
curr_mem[of all sets] = NULL_DBA;
curr_db = 0;
RETURN CODES
5 S_UNAVAIL Database is not availadle. Either another user has exclusive access or your exclusive access request cannot be satisfied because others are using the database.
-4 S_INVDB An invalid database name has been used or the database could by found.
-11 S_BADTYPE An invalid access mode type was specified. Be sure you are passing string as opposed to single character.
-22 S_DELSYS The current record is the system record.You are not aloowed to delete the system record.
-34 S_USERID No user id has been specified. You need to either have the BDUSERID enviroment variable defined or you need to call function d_dbuserid before d_open.
-35 S_NAMELEN The fully qualified name of a control or database file was longer that 47 characters.
-42 S_BADUSERID The userid is invalid. it must contain only alphanumeric characters or underscore ("_").
-43 S_NONETBIOS There is no NetBIOS instaled on the machine.
-44 S_BADBDPACH The number of elements in DBDPACH does not match the number of databases opened.
-45 S_BADBFPACH The number of elements in DBDPACH does not match the number of databases opened.
-904 S_NOMEMORY There is not enought available memory for all of the required db_VISTA runtime tables. Try calling function d_setpages with fewer pages before calling d_open.
-920 S_NOLOCKMGR Unable to open lock manager session. The lock manager has probably not been started.
-921 S_DUPUSERID Specified user id is being used by another user.
EXAMPLE
switch (operation) { case ACCTS_PAY: /* open for shared accounts payable usage*/ d_open("genledg;acctspay","s"); break; case ACCTS_RCV: /* open for shared accounts recievable usage*/ d_open("genledg;acctsrcv","s"); break; case MONTH_END: /* open for exclusive month-end processing*/ d_open("genledg","x"); break; } if (db_status == S_UNAVAIL) user_message("database unavailable") else if (db_status != S_OKAY) terminate(); ......