DB_Open

This function opens an existing database file. Opening a file initiates the following actions:

  1. If the file is marked read only, the DOS read only bit is cleared.
  2. The lookup table and last used viewpoint are read from the disk. If they do not exist (most probably because the machine was rebooted while a database was open), they are created.
  3. The field definitions (if any) are loaded.
  4. The Undo point is set. See "DB_Undo" on page 11-430 for more information.
  5. If the system sort order may have changed, all viewpoint tables are invalidated. This causes the first swap to each new viewpoint to be recomputed; they will be read in off of the disk afterwards. The new sort hash is stored in the file. See "Localization, Sorting, and Omnibook Files" on page 11-441 for more details.
  6. If the file is an OmniBook file, then in addition to Step 5, the file is translated. The translation affects Upper ASCII characters (128. . .255) in most records, and they are mapped from the Windows ANSI CodePage to CodePage 850. This process may take a while. In addition to converting to CodePage 850, all viewpoint definitions are flagged as "General" since the HP Omnibook and Palmtop FISL Card parsing routines are incompatible. The database engine sets the flag DB_WASTRANSLATED to indicate a translation has taken place if the application needs to translate its own record types.
  7. Opening passworded files will take two DB_Opens: opening the first time (and passing NULL as the password) will return with a DB_PASSWORDFAILED error. If this error is returned, the user should be prompted for a password, and the DB_Open() function re-attempted, passing the new password. DB_PASSWORDFAILED will be returned until the correct password is used.
A DB_MAYBEINUSE error will be returned if the database file has been opened by another application and not yet closed. This error prevents multiple applications from accessing the same database file at the same time. This error can also occur if the database was open when the machine was rebooted. The user should be prompted for action (either continue or abort). To continue, the DB_Reset() function needs to be called, and the DB_Open() must be reissued.

See comments in "DB_Create" on page 11-422 for the FieldCallBack and ROMCallBack functions.