# Database Error Codes

Topics

:

Overview
Conditional Directives
Enumerations
Exception Classes
Functions

Overview

The 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 gxDatabaseError 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 gxDatabaseError { // Database error codes
      gxDBASE_NO_ERROR = 0,        // No errors reported
      gxDBASE_INVALID_CODE,        // Invalid error code
      gxDBASE_ACCESS_VIOLATION,    // Access Violation
      gxDBASE_ASSERT_ERROR,        // Assertion failed
      gxDBASE_BAD_CLASS_ID,        // Wrong object type
      gxDBASE_BAD_OBJECT_ADDRESS,  // Bad object address
      gxDBASE_BAD_REFERENCE,       // Bad Reference
      gxDBASE_BLOCK_ALLOC_ERROR,   // Block allocation error
      gxDBASE_CACHE_FULL,          // Cache full
      gxDBASE_CHECKSUM_ERROR,      // Checksum Error
      gxDBASE_DIVIDEBY_ZERO,       // Divide By Zero Error
      gxDBASE_DUPLICATE_ENTRY,     // Duplicate entry error
      gxDBASE_ENTRY_NOT_FOUND,     // Specified entry was not found
      gxDBASE_EOF_ERROR,           // Unexpected end of file
      gxDBASE_FILE_CLOSE_ERROR,    // Error closing file
      gxDBASE_FILE_CORRUPT,        // File corrupted
      gxDBASE_FILE_CREATION_ERROR, // Error creating file
      gxDBASE_FILE_EXISTS,         // File already exists
      gxDBASE_FILE_NOT_OPEN_ERROR, // Trying to use a closed file
      gxDBASE_FILE_NOT_READY,      // File not ready (failed or closed file)
      gxDBASE_FILE_NOT_WRITEABLE,  // Could not write to file
      gxDBASE_FILE_OPEN_ERROR,     // Error opening file
      gxDBASE_FILE_POSITION_ERROR, // Cannot obtain the current file position
      gxDBASE_FILE_READ_ERROR,     // Error reading file
      gxDBASE_FILE_SEEK_ERROR,     // Error seeking in file
      gxDBASE_FILE_WRITE_ERROR,    // Error writing to file
      gxDBASE_INSERTION_ERROR,     // Error inserting database entry
      gxDBASE_MEM_ALLOC_ERROR,     // Memory allocation error
      gxDBASE_NO_DATABASE_OPEN,    // No database open
      gxDBASE_NO_FILE_EXISTS,      // No such file exists
      gxDBASE_NO_OBJECTS_EXIST,    // No objects exist
      gxDBASE_NULL_PTR,            // Accessing a null pointer
      gxDBASE_OBJECT_EXISTS,       // Object already exists
      gxDBASE_OPEN_FILE_REFERENCE, // Another object is referencing this file
      gxDBASE_OVERFLOW,            // Math overflow
      gxDBASE_PARSE_ERROR,         // Parse error
      gxDBASE_PATH_ERROR,          // Invalid path
      gxDBASE_READ_ONLY_FILE,      // Trying to write to read-only file
      gxDBASE_STACK_EMPTY,         // Stack empty
      gxDBASE_STACK_FULL,          // Stack full
      gxDBASE_SYNC_ERROR,          // Synchronization Error
      gxDBASE_UNDERFLOW,           // Math under-flow
      gxDBASE_WRONG_FILE_TYPE,     // Wrong file type

      // Persistent lock error codes
      gxDBASE_INVALID_LOCK_TYPE,        // Invalid lock type specified
      gxDBASE_FILELOCK_ACCESS_ERROR,    // File lock cannot be accessed
      gxDBASE_FILELOCK_ERROR,           // Error locking the file
      gxDBASE_RECORDLOCK_ACCESS_ERROR,  // Record lock cannot be accessed
      gxDBASE_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."

gxCDatabaseException

- 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 gxDatabase internal error variable.

Functions

const char *gxDatabaseExceptionMessage(gxDatabaseError err)

- Standalone function that returns a null terminated string, which can be use to log or print a database exception message.

End Of Document