/* ----------------------------------------------------------------------------
 * Raima Database Manager
 *
 * Copyright (c) 2001-2008 Birdstep Technology Inc.,  All rights reserved.
 *
 * Use of this software, whether in source code format, or in executable,
 * binary object code form, is governed by the Birdstep LICENSE which
 * is fully described in the LICENSE.TXT file, included within this
 * distribution of files.
 * ----------------------------------------------------------------------------
 */
#if !defined(DBERR_H)
#define DBERR_H

#include "rdm.h"

typedef struct {
    int32_t    sStatus;
    const char *name;
    const char *errorstring;
} RDM_ERROR;

#if defined(RDM_INCLUDE_DBERR_TABLE)
static const RDM_ERROR rdm_errors [] = {
    { -9021, "SYS_BADHASH",       "hash malformed"},
    { -9020, "SYS_INV_RHS_HANDLE","invalid internal RHS handle"},
    { -9019, "SYS_FILEMODIFIED",  "locked file was modified by another user"},
    { -9018, "SYS_EOF",           "attempt to write past EOF"},
    { -9017, "SYS_DCHAIN",        "bad dchain"},
    { -9016, "SYS_PZNEXT",        "bad pznext"},
    { -9015, "SYS_FILESIZE",      "maximum file size exceeded"},
    { -9014, "SYS_INVEXTEND",     "illegal attempt to extend file"},
    { -9013, "SYS_PZACCESS",      "invalid access to page zero"},
    { -9012, "SYS_INVPGSIZE",     "invalid cache page size"},
    { -9011, "SYS_INVPGCOUNT",    "bad page tag page count"},
    { -9010, "SYS_HASHCYCLE",     "cycle detected in hash chain"},
    { -9009, "SYS_INVHOLD",       "bad hold count"},
    { -9007, "SYS_INVSORT",       "illegal sort ordering"},
    { -9006, "SYS_INVFLDTYPE",    "illegal field type"},
    { -9005, "SYS_BADOPTKEY",     "calculating optkey index"},
    { -9004, "SYS_BADFREE",       "attempt to free empty table"},
    { -9003, "SYS_KEYEXIST",      "key value already exists"},
    { -9002, "SYS_BADTREE",       "b-tree malformed"},
    { -966, "S_DBDREAD",          "Error reading dbd file"},
    { -965, "S_REPLOG_ERROR",     "Error creating/writing the replication log"},
    { -961, "S_JNIERROR",         "Java Native Method Error"},
    { -940, "S_EACCESS",          "file in use"},
    { -939, "S_READONLY",         "unable to update file due to READONLY option"},
    { -933, "S_FCN_SEQUENCE",     "function(s) called in an incorrect order"},
    { -932, "S_BUFFER_TOO_SMALL", "supplied buffer is too small"},
    { -931, "S_INVLOGFILE",       "invalid log file format"},
    { -929, "S_BLOBERR",          "unexpected blob error"},
    { -928, "S_BLOBPOS",          "invalid blob position"},
    { -927, "S_BLOBUPD",          "attempt to directly update a blob field"},
    { -926, "S_NOTBLOB",          "the specified field is not a blob field"},
    { -924, "S_INVNULL",          "invalid NULL parameter"},
    { -922, "S_LMBUSY",           "the lock manager table(s) are full"},
    { -921, "S_DUPUSERID",        "DBUSERID is already being used"},
    { -919, "S_BADWRITE",         "error writing to a data or key file"},
    { -918, "S_VARDATAPTR",       "vardata pointer inconsistency"},
    { -916, "S_DEBUG",            "debug check interrupt"},
    { -914, "S_BADREAD",          "error reading from a data or key file"},
    { -911, "S_VARDATALEN",       "vardata length inconsistency"},
    { -910, "S_KEYERR",           "key file inconsistency"},
    { -909, "S_RECLIMIT",         "file record limit exceeded"},
    { -908, "S_BADLOCKS",         "inconsistent database locks"},
    { -906, "S_COMMITFAILED",     "commit failed due to prelog file rename failure"},
    { -905, "S_NOFILE",           "error opening data or key file"},
    { -904, "S_NOMEMORY",         "out of memory"},
    { -903, "S_MKDIR",            "unable to create direcory"},
    { -902, "S_FAULT",            "page fault"},
    { -901, "S_SYSERR",           "system error"},
    { -900, "S_NOSPACE",          "out of disk space"},

    { -812, "S_QA_ILLEGAL_TFS_COMBINATION",    "Illegal combination of options for different tfs types"},
    { -811, "S_QA_TEST_TIMEOUT",               "Test timed out"},
    { -810, "S_QA_ILLEGAL_FILENAME",           "Illegal filename"},
    { -809, "S_QA_ILLEGAL_NAMESPACE",          "Illegal namespace"},
    { -808, "S_QA_FEATURE_NOTIMPLEMENTED",     "Feature have not been implemented"},
    { -807, "S_QA_ILLEGAL_USE_OF_STOP_WATCH",  "Illegal use of stop watch"},
    { -806, "S_QA_HAS_FLOAT_REQUIRED",         "Illegal use of floating point"},
    { -805, "S_QA_CASE_FAILED",                "A test case failed"},
    { -804, "S_QA_NEED_DESCRIPTION",           "A description is missing for a case"},
    { -803, "S_QA_HELP",                       "Help text returned"},
    { -802, "S_QA_MISSING_ARGUMENT",           "Command line option is missing an argument"},
    { -801, "S_QA_NO_TESTS_SELECTED",          "No tests was selected by the command line options given"},
    { -800, "S_QA_CASE_DESCRIBED",             "T test case have been described"},
    { -703, "EMBED_CONTENT_DONT_MATCH",     "Content don't match the embedded hash for the particular file"},
    { -702, "EMBED_ILLEGAL_NAMESPACE",      "Illegal namespace provided to the embedder"},
    { -701, "EMBED_UNKNOWN_COMMAND",        "Command not supported by the embedder"},
    { -700, "EMBED_FILE_NOT_FOUND",         "File not found by the embedder"},

    { -512, "DB_IMP_DUPMEM",      "specified member already member of set"},
    { -511, "DB_IMP_INVDB",       "invalid database name reference"},
    { -510, "DB_IMP_INVREF",      "reference uses non-unique identifier"},
    { -509, "DB_IMP_INVOWN",      "specified owner not a valid owner of set"},
    { -508, "DB_IMP_INVMEM",      "record not a valid member of set"},
    { -507, "DB_IMP_NOKEY",       "unique key value missing"},
    { -506, "DB_IMP_NOFLD",       "field missing"},
    { -505, "DB_IMP_FLDSIZE",     "string field truncated"},
    { -504, "DB_IMP_FLDTYPE",     "unexpected data type"},
    { -503, "DB_IMP_INVSET",      "unrecognized set name"},
    { -502, "DB_IMP_INVFLD",      "unrecognized field name"},
    { -501, "DB_IMP_INVREC",      "unrecognized record name"},

    { -231, "S_TX_INI_NOTEDITED",  "INI file is not being edited"},
    { -230, "S_TX_INI_EDITED",     "INI file is being edited"},
    { -229, "S_TX_BLOCKED",        "Mirroring is blocking transactions"},
    { -228, "S_TX_IASYNC_ON",      "Internal asynchronous mode is enabled"},   
    { -227, "S_TX_INVTFSTYPE",     "Invalid TFS type"},
    { -226, "S_TX_NO_REMOTE",      "Remote connections not allowed"},
    { -225, "S_TX_DOCROOT_USED",   "The docroot is already in use"},
    { -224, "S_TX_TFSNOTINITED",   "TFS was not intialized"},
    { -223, "S_TX_NO_FILE_ACCESS", "illegal attempt to cause a file access on a diskless system"},
    { -222, "S_TX_ILLEGAL_MOD",   "Illegal attempt to modify file(s) on read-only device"},
    { -221, "S_TX_TXPRECOMMIT",   "transaction is precommitted"},
    { -220, "S_TX_INVTFS",        "Invalid TFS handle"},
    { -219, "S_TX_DBOPEN",        "Cannot destroy a database that is open by others"},
    { -218, "S_TX_INVINI",        "Invalid INI file"},
    { -217, "S_TX_ACCEPT",        "TCP/IP accept failure in TFS"},
    { -216, "S_TX_LISTEN",        "TCP/IP listen failure in TFS"},
    { -215, "S_TX_HOSTNAME",      "TFS host name not found"},
    { -214, "S_TX_CONNECT",       "failed to connect to TFS"},
    { -213, "S_TX_DBACTIVE",      "database is currently in use"},
    { -212, "S_TX_INVDB",         "database not found in database table"},
    { -211, "S_TX_TRUNCATED",     "data retrieve had to be truncated"},
    { -210, "S_TX_INVFILE",       "file not found in file table"},
    { -209, "S_TX_TXNOTACTIVE",   "no transaction is active"},
    { -208, "S_TX_NOTVERIFIED",   "user is not verified"},
    { -207, "S_TX_INVUSERID",     "userid not found in user table"},
    { -206, "S_TX_MAXUSERS",      "ran out of user connections"},
    { -205, "S_TX_DUPUSER",       "same dbuserid already in use"},
    { -204, "S_TX_WRITEFAIL",     "failed to write to a file"},
    { -203, "S_TX_NETWRITE",      "failure to write data to network"},
    { -202, "S_TX_NETREAD",       "failure to read data from network"},
    { -201, "S_TX_NOPAGE",        "requested page doesn't exist"},
    { -200, "S_TX_ERROR",         "generic tx_ error"},

    { -130, "S_CRYPT_MISMATCH",   "The database encryption key does not match the file encryption key."},
    { -129, "S_INVDOCROOT",       "An invalid docroot path"},
    { -128, "S_INVENCTYPE",       "An invalid encryption type"},
    { -127, "S_REP_NODB",         "Database is not replicated/mirrored"},
    { -126, "S_REP_INVOP",        "Invalid operation during replication"},
    { -125, "S_LOG_INVATTR",      "An invalid entry attribute value"},
    { -124, "S_LOG_INVFLAG",      "Invalid option flag value"},
    { -123, "S_LOG_OUTDATED",     "Log file is outdated"},
    { -122, "S_LOG_SKIPPED",      "Log files are out of sequence"},
    { -121, "S_LOG_NOSCHEMA",     "Slave has no schema information"},
    { -120, "S_LOG_INVINDEX",     "An invalid table/column index"},
    { -119, "S_LOG_INVHANDLE",    "An invalid log or file handle was passed to the function"},
    { -118, "S_TYPE_UNKNOWN",     "The type was not specified and can not be determined"},
    { -117, "S_TYPE_MISMATCH",    "The specified type is not consistent with the current type"},
    { -116, "S_MULTIPLE_DBS",     "Opening multiple dbs in one call is not supported by this API, use multiple calls"},
    { -115, "S_INV_KEYLEN",       "The size of the key buffer is not valid for the specified key"},
    { -114, "S_RECORD_GONE",      "the singleton cursor has been invalidated (record deleted)"},
    { -113, "S_BLOB_BAD_SIZE",    "Not enough data in the blob to satisfy the read request"},
    { -112, "S_UNION_DBDMISMATCH","Unioned databases do not have matching DBD structure"},
    { -111, "S_INV_ITERATION",    "invalid iteration - attempt to go before 'BeforeFirst' or past 'AfterLast'"},
    { -110, "S_INVCURSOR_REC",    "invalid record for this cursor"},
    { -109, "S_INVCURSOR_FLD",    "invalid field for this cursor"},
    { -108, "S_NOT_ENCRYPTED",    "database is not encrypted"},
    { -107, "S_INVENCRYPT",       "invalid encryption key"},
    { -106, "S_SET_GONE",         "the set cursor has been invalidated (owner record deleted)"},
    { -105, "S_LOST_POSITION",    "cursor position was lost and must be reset"},
    { -104, "S_NOT_RELATED",      "cursor are not related and can not be compared"},
    { -103, "S_INVCURSOR_OP",     "Operation invalid for this cursor"},
    { -102, "S_NOTSINGLETON",     "The specified record is not a singleton record type"},
    { -101, "S_INVCURSOR",        "Invalid RDM cursor"},
    { -100, "S_TRUNCATE",         "data truncated"},
    { -99,  "S_INVBCD",           "invalid BCD value"},
    { -98,  "S_INVUTF",           "invalid UTF-8 or UTF-16 string"},
    { -97,  "S_RECISINSET",       "cannot quick initialize because the record type participates in a set"},
    { -96,  "S_FILEISSHARED",     "cannot quick initialize because one or more files are shared"},
    { -95,  "S_DBA_RANGE",        "database address is out of range"},
    { -94,  "S_MIRSYNC_TIMEOUT",  "Synchronous mirroring timeout"},    
    { -93,  "S_DBDMISMATCH",      "DBD in memory does not match DBD on disk"},
    { -92,  "S_NOMIRSERVER",      "Unable to connect to a mirroring server"},
    { -91,  "S_IN_INIT_TRANS",    "Changes not allowed when an initialization transaction is active"},
    { -90,  "S_IN_CHANGE_TRANS",  "Initialize not allowed when a change transaction is active"},
    { -89,  "S_MIRSYNC_ERROR",    "Generic synchronous mirroring error"},
    { -88,  "S_MIRSYNC_DENIED",   "Database already used in synchronous mirroring"},
    { -87,  "S_SLAVEREADONLY",    "Attempted to open a slave database in non-readonly mode"},
    { -86,  "S_UNOMISMATCH",      "Union values do not match"},
    { -85,  "S_REPRDMSERR",       "Error replicating to RDM Server Slave"},
    { -84,  "S_INVDBASLOT",       "Invalid DBA slot value"},
    { -83,  "S_INVDBAFILE",       "Invalid DBA file value"},
    { -82,  "S_INVURLARGFMT",     "Invalid URL argument format"},
    { -81,  "S_SHUTDOWN",         "A server is shutting down"},
    { -80,  "S_DBALREADYOPEN",    "Database is already open in this task"},
    { -79,  "S_INROT",            "Cannot apply a write or exclusive lock while in a read-only transaction"},
    { -78,  "S_HASWRITELOCKS",    "A read-only transaction cannot start because the user holds write locks"},
    { -77,  "S_NOROTACTIVE",      "No read-only transaction is active"},
    { -76,  "S_ROTACTIVE",        "A read-only transaction is already active"},
    { -75,  "S_RECOVERY_FAILED",  "Recovery failed"},
    { -74,  "S_REPLOGSTRING",     "Invalid replication log string format"},
    { -73,  "S_REPLOGENDIAN",     "Invalid replication log endian format"},
    { -72,  "S_REPLOGDBA",        "Invalid replication log database address format"},
    { -71,  "S_REPLOGVER",        "Invalid replication log version"},
    { -70,  "S_INVDBD",           "The DBD is not compatible with the runtime library"},
    { -69,  "S_DBACTIVE",         "Database is currently in use"},
    { -68,  "S_DDLERROR",         "There were errors processing a DDL file"},
    { -67,  "S_TRPRECOMMITTED",   "A precommitted transaction must be committed or aborted before further operations are allowed"},
    { -66,  "S_DELCIRC",          "Illegal attempt to delete circular record"},
    { -65,  "S_INVSTRING",        "Invalid database string format"},
    { -64,  "S_INVENDIAN",        "Invalid database endian format"},
    { -63,  "S_INVDBA",           "Invalid database address format"},
    { -62,  "S_INVFILE",          "Invalid file type for operation"},
    { -61,  "S_INVTFSSPEC",       "Invalid TFS specification"},
    { -60,  "S_REPINVLOCK",       "Invalid 'exclusive lock' request for a replicated database"},
    { -59,  "S_REPINVMODE",       "Invalid open mode for a replicated database"},
    { -58,  "S_REPBADTYPE",       "bad replication type"},
    { -57,  "S_IMPBADDATA",       "bad data"},
    { -56,  "S_IMPBADXML",        "bad xml data"},
    { -55,  "S_DEFUNCT",          "This API is defunct and is not supported"},
    { -54,  "S_NOTIMPLEMENTED",   "option is not implemented in this version"},
    { -53,  "S_UNIONINVMODE",     "Invalid open mode for a union database"},
    { -52,  "S_INVTASK",          "invalid task"},
    { -51,  "S_INVFORUNIONDB",    "operation invalid for a union database"},
    { -50,  "S_INVID",            "invalid internal ID"},
    { -49,  "S_INVPTR",           "invalid pointer"},
    { -48,  "S_DBCLOSE",          "database not closed"},
    { -47,  "S_INVINDEX",         "Invalid index type"},
    { -46,  "S_NOTYPE",           "no current record type"},
    { -45,  "S_INVARG",           "Invalid function argument"},
    { -44,  "S_INVPKEY",          "Invalid partial key specification"},
    { -43,  "S_INVREPHANDLE",     "Invalid replication handle provided"},
    { -42,  "S_BADUSERID",        "bad DBUSERID (too long or contains non-alphanumeric)"},
    { -41,  "S_INVKEY",           "invalid optional key - key cannot be used in d_setkey"},
    { -40,  "S_INVNUM",           "invalid record or set number"},
    { -39,  "S_COMKEY",           "record/field has/in a compound key"},
    { -38,  "S_BADFIELD",         "field is not defined in current record type"},
    { -37,  "S_NOTOPTKEY",        "field is not an optional key field"},
    { -36,  "S_INVTRID",          "invalid transaction id"},
    { -35,  "S_NAMELEN",          "database path or file name too long"},
    { -34,  "S_USERID",           "unspecified user id"},
    { -33,  "S_STATIC",           "locks not allowed on static files"},
    { -32,  "S_EXCLUSIVE",        "exclusive access required"},
    { -31,  "S_NOTRANS",          "cannot update database outside a transaction"},
    { -30,  "S_DBOPENED",         "operation not completed because the database is opened elsewhere"},
    { -29,  "S_TRFREE",           "cannot free locks within a transaction"},
    { -28,  "S_DBD_NONAMES",      "incompatible legacy DBD file - does not contain record/field/set names"},
    { -27,  "S_TRNOTACT",         "transaction not active"},
    { -26,  "S_TRACTIVE",         "transaction already active"},
    { -25,  "S_TRANSID",          "transaction ID not supplied"},
    { -24,  "S_NOTLOCKED",        "attempt to access unlocked set/record"},
    { -23,  "S_NOTFREE",          "illegal attempt to lock locked set/record"},
    { -22,  "S_DELSYS",           "illegal attempt to delete/add system record"},
    { -21,  "S_INCOMPAT",         "incompatible dictionary file"},
    { -20,  "S_SETPAGES",         "must call d_setpages() before opening the database"},
    { -19,  "S_INVMEM",           "record not legal member of set"},
    { -18,  "S_INVOWN",           "record not legal owner of set"},
    { -17,  "S_NOTKEY",           "field is not a valid key"},
    { -16,  "S_NOTCON",           "record not connected to set"},
    { -15,  "S_ISCOMKEY",         "field is a compound key"},
    { -14,  "S_ISOWNED",          "member already owned"},
    { -13,  "S_ISMEM",            "record is member of set(s)"},
    { -12,  "S_HASMEM",           "record is owner of non-empty set(s)"},
    { -11,  "S_BADTYPE",          "invalid lock value"},
    { -10,  "S_KEYREQD",          "key value required"},
    {  -9,  "S_NOCM",             "set has no current member"},
    {  -8,  "S_NOCO",             "set has no current owner"},
    {  -7,  "S_NOCR",             "no current record"},
    {  -6,  "S_INVADDR",          "invalid database address"},
    {  -5,  "S_INVFLD",           "invalid field name"},
    {  -4,  "S_INVDB",            "cannot open dictionary"},
    {  -3,  "S_INVREC",           "invalid record"},
    {  -2,  "S_INVSET",           "invalid set"},
    {  -1,  "S_DBOPEN",           "database not opened"},
    {   0,  "S_OKAY",             "normal return, okay"},
    {   1,  "S_EOS",              "end of set"},
    {   2,  "S_NOTFOUND",         "record not found"},
    {   3,  "S_DUPLICATE",        "duplicate key"},
    {   4,  "S_KEYSEQ",           "field type used out of sequence in d_keynext"},
    {   5,  "S_UNAVAIL",          "database file currently unavailable"},
    {   6,  "S_DELETED",          "record/set deleted since last accessed"},
    {   7,  "S_UPDATED",          "record/set updated since last accessed "},
    {   10, "S_SETCLASH",         "set ptrs invalidated by another user"},
    {   11, "S_EOF",              "end of file encountered"},
    {   12, "S_TX_TIMEOUT",       "Timeout in select function"},
    {   13, "S_REFERENCING",      "File can be read locally"},
    {   14, "S_EOC",              "End of cursor"},
    {   15, "S_TX_INI_UPDATED",   "Schema information updated"},
    {   16, "S_FILECHANGED",      "Internal status indicating the cache is out of sync"},
    {   17, "S_UPDATE_ABORTED",   "An update transaction was aborted when closing the database"},
    {   18, "S_SNAPSHOT_ENDED",   "A read-only transaction was closed when closing the database"},
    {   19, "S_READ_ENDED",       "Read locks were freed when closing the database"},
    {   20, "S_READ_TRUNCATE",    "The read operation was truncated and may not contain complete fields"},
    {   21, "S_OKAY_WITH_INFO",   "Function succeeded with additional info"},
    {   22, "S_NOT_IN_CURSOR",    "Record is not in the cursor collection"},
    {   23, "S_REPLOG_EOF",       "Replication Log EOF"},
    {   24, "S_REP_MASTEREMPTY",  "Master database is empty"},
    {   25, "S_SKIP",             "A transaction should be skipped"},
    {   26, "S_NEEDS_FLUSH",      "The checkpointer needs to flush transactions"}
};
#endif
#endif


