VBD Database Error Codes


Topics:

Overview
Conditional Directives
Enumerations
Exception Classes
Functions


Overview

The VBD database engine error functions and classes are used to catch and/or record database exceptions that occur during run-time. This implementation can be used with or without C++ built-in exception handling. If C++ exception handling is not enabled then the vbDatabaseError enumerated constants can be used to evaluate database errors.


Conditional Directives

__CPP_EXCEPTIONS__ - Directive used to enable C++ exception handling.


Enumerations

Integer constants used to record the last reported error condition and as return values for the database engine file functions.

enum vbDatabaseError { // Database error codes
  vbDBASE_NO_ERROR = 0,        // No errors reported
  vbDBASE_INVALID_CODE,        // Invalid error code
  vbDBASE_ACCESS_VIOLATION,    // Access Violation
  vbDBASE_ASSERT_ERROR,        // Assertion failed
  vbDBASE_BAD_CLASS_ID,        // Wrong object type
  vbDBASE_BAD_OBJECT_ADDRESS,  // Bad object address
  vbDBASE_BAD_REFERENCE,       // Bad Reference
  vbDBASE_CACHE_FULL,          // Cache full
  vbDBASE_CHECKSUM_ERROR,      // Checksum Error
  vbDBASE_DIVIDEBY_ZERO,       // Divide By Zero Error
  vbDBASE_EOF_ERROR,           // Unexpected end of file
  vbDBASE_FILE_CLOSE_ERROR,    // Error closing file
  vbDBASE_FILE_CORRUPT,        // File corrupted
  vbDBASE_FILE_CREATION_ERROR, // Error creating file
  vbDBASE_FILE_EXISTS,         // File already exists
  vbDBASE_FILE_NOT_OPEN_ERROR, // Trying to use a closed file
  vbDBASE_FILE_NOT_READY,      // File not ready 
  vbDBASE_FILE_NOT_WRITEABLE,  // Could not write to file 
  vbDBASE_FILE_OPEN_ERROR,     // Error opening file
  vbDBASE_FILE_POSITION_ERROR, // Cannot obtain the file position
  vbDBASE_FILE_READ_ERROR,     // Error reading file  
  vbDBASE_FILE_SEEK_ERROR,     // Error seeking in file
  vbDBASE_FILE_WRITE_ERROR,    // Error writing to file
  vbDBASE_NO_DATABASE_OPEN,    // No database open
  vbDBASE_NO_FILE_EXISTS,      // No such file exists
  vbDBASE_NO_OBJECTS_EXIST,    // No objects exist
  vbDBASE_NULL_PTR,            // Accessing a null pointer 
  vbDBASE_OBJECT_EXISTS,       // Object already exists
  vbDBASE_OPEN_FILE_REFERENCE, // File referenced by another object
  vbDBASE_OVERFLOW,            // Math overflow
  vbDBASE_PARSE_ERROR,         // Parse error
  vbDBASE_PATH_ERROR,          // Invalid path
  vbDBASE_READ_ONLY_FILE,      // Trying to write to read-only file
  vbDBASE_STACK_EMPTY,         // Stack empty
  vbDBASE_STACK_FULL,          // Stack full
  vbDBASE_SYNC_ERROR,          // Synchronization Error
  vbDBASE_UNDERFLOW,           // Math under-flow
  vbDBASE_WRONG_FILE_TYPE,     // Wrong file type

  // Persistent lock error codes
  vbDBASE_INVALID_LOCK_TYPE,        // Invalid lock type specified
  vbDBASE_FILELOCK_ACCESS_ERROR,    // File lock cannot be accessed
  vbDBASE_FILELOCK_ERROR,           // Error locking the file
  vbDBASE_RECORDLOCK_ACCESS_ERROR,  // Record lock cannot be accessed
  vbDBASE_RECORDLOCK_ERROR          // Error locking a record
};


Exception Classes

Class declarations for exceptions representing program errors. This implementation is provided for optional use with the C++ built-in exception handling routines (try, catch, and throw) within the VBD class library.

vbCDatabaseException - Exception class thrown by the database engine file functions to indicate that a fatal file error condition has been reached. All database engine file calls must catch this exception and evaluate it by testing the vbDatabase internal error variable.


Functions

const char *vbDatabaseExceptionMessage(vbDatabaseError err) - Standalone function that returns a null terminated string, which can be use to log or print a database exception message.


End Of Document