/***************************************************************************
 * Raima Database Manager                                                  *
 *                                                                         *
 * Copyright (c) 2011 Raima Inc. All rights reserved.                      *
 *                                                                         *
 * Use of this software, whether in source code format, or in executable,  *
 * binary object code form, is governed by the Raima Inc. LICENSE          *
 * which is fully described in the LICENSE.TXT file, included within this  *
 * distribution of files.                                                  * 
 **************************************************************************/
/*----------------------------------------------------------------------------
   errtab.h:  RDM SQL Error Table header file.
----------------------------------------------------------------------------*/

#if !defined(__ERRTAB_H)
#define __ERRTAB_H

#include "rsqlerrs.h"

/* The sqlerrtab array is indexed by rsql_errcode.  
   New errors are added to the end of this table.
*/
#if defined(RSQL_DEBUGTRACE)
const RSQLERROR_DEFN sqlerrtab[] = {
#else
static const RSQLERROR_DEFN sqlerrtab[] = {
#endif
    /* GENERRORBEGIN */
    {"errINVHANDLE",        "02002", "invalid connection or statement handle"}, 
    {"errNEEDDATA",         "01000", "need data"},
    {"errIGNORE",           "RX001", "ignore this error"},
    {"errSQLERROR",         "RX002", "internal SQL error"},
    {"errNOMOREDATA",       "02000", "no more data"},
    {"errSUCCESS",          "00000", "no error was detected"},
    {"errTRUNCATE",         "01004", "data truncation"},
    {"errPSPFAILURE",       "RX003", "psp subsystem initialization failure"},
    {"errSYNTAX",           "42000", "syntax error"},
    {"errNOCRDB",           "42000", "no CREATE DATABASE has been issued"},
    {"errGENDDLFILE",       "RX004", "unable to open RDM core-level DDL file"},
    {"errBADREFDCOL",       "42000", "column is not declared in referenced table"},
    {"errPKNOTFOUND",       "42000", "matching primary key does not exist in referenced table"},
    {"errFKPKMISMATCH",     "42000", "foreign/primary key columns do not match"},
    {"errBADFORKEYCOL",     "42000", "foreign key column is not declared in table"},
    {"errDUPCOLNAME",       "42S21", "column already declared in table"},
    {"errDUPTABNAME",       "42S21", "table with the same name already been created"},
    {"errDUPCURSOR",        "3C000", "duplicate cursor name"},
    {"errNODOMAIN",         "42000", "specified domain name not found"},
    {"errTABNOTFOUND",      "42S02", "table not found"},
    {"errDATETIMEOVF",      "22008", "date/time value overflow"},
    {"errBADKEYCOL",        "42000", "key column not found"},
    {"errGENFILE",          "RX005", "unable to open file"},
    {"errNOMEMORY",         "HY013", "insufficent memory available for operation"},
    {"errBADFORMAT",        "42000", "bad formatting specification"},
    {"errBADBINLITERAL",    "22005", "bad binary literal specification"},
    {"errBADLITERAL",       "22005", "bad literal specification"},
    {"errTOOLONG",          "22001", "string literal too long"},
    {"errNODB",             "42000", "database does not exist"},
    {"errCATNOTFOUND",      "42000", "unable to open catalog file"},
    {"errINITDB",           "42000", "unable to initialize database"},
    {"errFILEIO",           "RX006", "file I/O error"},
    {"errNOTOPEN",          "08003", "connection is not open"},
    {"errINVARG",           "HY009", "invalid argument value"},
    {"errINVNULL",          "HY009", "invalid use of null pointer"},
    {"errOPENHDBCS",        "HY010", "must free all connection handles first"},
    {"errBADDATALEN",       "HY090", "invalid string or buffer length"},
    {"errTYPEATTR",         "07006", "data type attribute violation"},
    {"errCOLNUMBER",        "07009", "invalid descriptor index (column number)"},
    {"errPARNUMBER",        "07009", "invalid descriptor index (parameter number)"},
    {"errFCNSEQ",           "HY010", "function sequence error"},
    {"errTRACTIVE",         "25000", "transaction is active"},
    {"errTRNOTACT",         "25000", "transaction not active"},
    {"errRDMERROR",         "RX007", "RDM runtime error"},
    {"errCONNECTED",        "08000", "must call before connect"},
    {"errDBTBO",            "42000", "databases to be opened already specified"},
    {"errDBNOTOPEN",        "42000", "database not open"},
    {"errINSERTVALS",       "21S01", "insert value list does not match column list"},
    {"errSELECTCOLS",       "21S02", "SELECT result columns do not match column list"},
    {"errNOCOLUMN",         "42S22", "column not found"},
    {"errNUMPAR",           "07002", "insufficient number of parameters specified"},
    {"errNOTNULL",          "42000", "must specify value for column"},
    {"errTABNOTLISTED",     "42000", "table name not in FROM clause"},
    {"errCOLNOTFOUND",      "42S22", "column name not found"},
    {"errFETCHTYPE",        "HY106", "fetch type out of range"},
    {"errROWVALUE",         "HY107", "row value out of range"},
    {"errCURPOS",           "HY109", "invalid cursor position"},
    {"errCURSTATE",         "24000", "invalid cursor state"},
    {"errNOTSELECT",        "24000", "current/cursor's statement is not SELECT"},
    {"errRANGE",            "22003", "numeric value out of range"},
    {"errDATALOST",         "22003", "significant data lost due to truncation"},
    {"errREFINTEGRITY",     "23000", "referential integrity error"},
    {"errCLOSEHDBC",        "HY010", "connection not closed"},
    {"errDRVMEMORY",        "HY001", "driver memory allocation error"},
    {"errATTRVALUE",        "HY024", "invalid attribute value"},
    {"errOPTIONRANGE",      "HY092", "invalid attribute/option identifier"},
    {"errROWERROR",         "01S01", "error in row"},
    {"errOPTCHANGED",       "01S02", "option value changed to default"},
    {"errTYPEMISMATCH",     "42000", "data type mismatch"},
    {"errESCAPECHAR",       "22019", "invalid escape character"},
    {"errINVSTATE",         "RX008", "invalid statement state"},
    {"errWHERECALCS",       "42000", "aggregate functions not allowed in WHERE"},
    {"errDIVBY0",           "22012", "division by zero"},
    {"errESCAPE",           "42000", "escape clause syntax error"},
    {"errDDLNOTEXEC",       "42000", "prior prepared DDL statement not executed"},
    {"errINVPARAM",         "42000", "invalid use of parameter marker"},
    {"errDUPPROC",          "42000", "duplicate stored procedure name"},
    {"errNOPROC",           "RX009", "stored procedure file not found"},
    {"errNUMARGS",          "21000", "invalid number of arguments specified"},
    {"errJOINCOLS",         "42000", "joined columns must match exactly"},
    {"errKEYCOLLIMIT",      "42000", "too many columns declared in foreign/primary key"},
    {"errBADOUTERJOIN",     "42000", "no access path between outer joined tables"},
    {"errHDBCINUSE",        "08002", "connection already in use"},
    {"errREGISTERED",       "42000", "UDF/UDP/XTF already registered"},
    {"errVIRTABPOS",        "42000", "all standard tables must be declared before first virtual table"},
    {"errVIRTABCOLTYPE",    "42000", "data type not allowed for virtual table columns"},
    {"errVIRTABERROR",      "RX010", "virtual table function error"},
    {"errNOTREGISTERED",    "42000", "reference to unregistered UDF/UDP/Virtual Table"},
    {"errUDF",              "RX011", "user-defined function error"},
    {"errUDFNOVAL",         "RX012", "no result from user-defined function"},
    {"errUDFDEFN",          "RX013", "UDFLOADTABLE entry definition error"},
    {"errUDFARG",           "21000", "invalid funtion argument type"},
    {"errUDFNOARGS",        "21000", "incorrect number of funtion arguments"},
    {"errFKSETNULL",        "42000", "SET NULL cannot be specified when nulls are not allowed"},
    {"errINSERTCOLREF",     "42000", "invalid column reference in INSERT expression"},
    {"errDUPLICATE",        "42000", "duplicate primary/unique key value"},
    {"errNOSETNULL",        "42000", "SET NULL not allowed with ON UPDATE"},
    {"errNOCASCADE",        "42000", "ON UPDATE CASCADE not allowed when foreign key column is used in a key"},
    {"errRESTRICTED",       "42000", "changes to referenced restricted primary/unique key not allowed"},
    {"errDUPJOINCOL",       "42000", "duplicate join column"},
    {"errNOJOINCOLMATCH",   "42000", "no matching join columns"},
    {"errSORTCOLREF",       "42000", "invalid order/group by column reference"},
    {"errFCNARG",           "21000", "invalid function argument"},
    {"errNUMFCNARGS",       "42000", "invalid number of specified function arguments"},
    {"errREADONLY",         "RX014", "operation is read only"},
    {"errINVSTMT",          "RX015", "invalid statement type"},
    {"errDISTINCT",         "42000", "only one DISTINCT aggregate function is allowed"},
    {"errCANCELED",         "HY008", "statement execution canceled by user"},
    {"errGROUPBYAGGFN",     "42000", "aggregate functions not allowed in GROUP BY"},
    {"errBADCTYPE",         "07006", "invalid C data type"},
    {"errBADSTYPE",         "07006", "invalid SQL data type"},
    {"errNOTCURSOR",        "07005", "prepared statement is not a valid cursor"},
    {"errINVDESCIDX",       "07009", "invalid descriptor index"},
    {"errTXUNKNOWN",        "25S01", "transaction state unknown"},
    {"errNOTPREPARED",      "HY007", "associated statement is not prepared"},
    {"errINVOPNOW",         "HY011", "invalid operation at this time"},
    {"errINVTXTYPE",        "HY012", "invalid transaction operation code"},
    {"errINVIRDMOD",        "HY016", "cannot modify an implementation row descriptor"},
    {"errAUTODESCR",        "HY017", "invalid use of implicit descriptor handle"},
    {"errBADDESCINFO",      "HY021", "inconsistent descriptor information"},
    {"errDESCRANGE",        "HY091", "invalid descriptor field identifier"},
    {"errSCALE",            "HY094", "invalid scale value"},
    {"errPARMTYPE",         "HY105", "invalid parameter type"},
    {"errTIMEOUT",          "HYT00", "timeout expired"},
    {"errNOTCAPABLE",       "HYC00", "driver not capable"},
    {"errNOTIMPLEMENTED",   "HYC00", "optional feature not implemented"},
    {"errINVCONVERT",       "HYC00", "invalid conversion"},
    {"errNOINDVAR",         "22002", "indicator variable required but not supplied"},
    {"errNOTSUPPORTED",     "IM001", "function not supported"},
    {"errINVTFSSPEC",       "42000", "invalid TFS location spec, should be: \"tfs*//*/\" or \"@hostname:port\""},
    {"errINVTFSTYPE",       "42000", "invalid TFS type"},
    {"errIEF",              "RX016", "import/export error"},
    {"errTFSERROR",         "RX017", "TFS system error"},
    {"errREMOTEERROR",      "RX018", "JNI/ADO.Net system error"},
    {"errCOMERROR",         "RX019", "RPC communication error"},
    {"errROTRACT",          "25000", "read-only transaction is active"},
    {"errUNLOCKINTRANS",    "25000", "unlock not allowed in a transaction"},
    {"errNOTLOCKED",        "25000", "table is not locked"},
    {"errLOCKSACTIVE",      "25000", "operation not allowed due to active read locks"},
    {"errNOPENDBS",         "42000", "DDL requires that no databases be open"},
    {"errMULTIDBTRANS",     "25000", "multiple database transactions are not allowed"},
    {"errINVDATEFMT",       "42000", "invalid date format"},
    {"errINVDATESEP",       "42000", "invalid date separator"},
    {"errINVOPENMODE",      "42000", "invalid db open mode"},
    {"errEXCLUSIVE",        "RX020", "operation requires exclusive database access"},
    {"errNOTUPDATEABLE",    "42000", "SELECT or column is not updateable"},
    {"errBLOBDEFAULT",      "42000", "default values not allowed on long var{char|binary} columns"},
    {"errBLOBEXPR",         "42000", "blobs cannot be referenced in expressions in deferred mode"},
    {"errDATAATEXEC",       "RX021", "data-at-exec params only allowed with INSERT VALUES/UPDATE"},
    {"errBLOBPARSONLY",     "RX022", "data-at-exec params only allowed for blob (long var...) columns"},
    {"errBADBLOBPAR",       "RX023", "data-at-exec param type not compatible with blob (long var...) column"},
    {"errCONCATNULL",       "HY020", "attempt to concatenate a null value"},
    {"errFCNRANGE",         "HY095", "function type out of range"},
    {"errCOLRANGE",         "HY097", "column type out of range"},
    {"errSCOPERANGE",       "HY098", "scope out of range"},
    {"errNULLRANGE",        "HY099", "nullable type out of range"},
    {"errUNIQUERANGE",      "HY100", "Uniqueness option type out of range"},
    {"errACCURANGE",        "HY101", "Accuracy option type out of range"},
    {"errSQLTYPE",          "HY004", "invalid SQL data type"},
    {"errCIRCTABREF",       "42000", "circular tables cannot be referenced"},
    {"errTFSFAILURE",       "RX024", "unable to connect to TFS"},
    {"errVARCHARLEN",       "42000", "must specify '(length)' with variable size columns"},
    {"errNOPGSANDROWS",     "42000", "cannot specify both MAXPGS and MAXROWS options"},
    {"errCIRTABDELETE",     "42000", "cannot delete rows from a circular table"},
    {"errMAXROWS",          "42000", "maxrows can only be specified with CREATE CIRCULAR TABLE"},
    {"errNOMAXROWS",        "42000", "maxrows must be specified with CREATE CIRCULAR TABLE"},
    {"errDEFEREDBLOB",      "42000", "cannot refer to blob column in WHERE in deferred reading mode"},
    {"errDBEXISTS",         "42000", "database already exists"},
    {"errTFSINIT",          "RX025", "TFS already initialized"},
    {"errLOCKMODE",         "RX026", "illegal locking mode"},
    {"errNOUPDCOLS",        "42000", "no columns have been updated"},
    {"errAUTOCOMMIT",       "42000", "operation not allowed when autocommit is enabled"},
    {"errCURSORTABLE",      "42000", "positioned UPDATE/DELETE table does not match cursor's"},
    {"errNOTINPROC",        "42000", "positioned UPDATE/DELETE not allowed in stored procedure"},
    {"errRDONLYFLAG",       "25000", "Inconsistent read-only transaction commit/rollback/end call"},
    {"errTABLEREF",         "42000", "duplicate table reference in FROM clause"},
    {"errDBOPENMODE",       "42000", "another database is already open in different mode"},
    {"errNESTEDAGGS",       "42000", "cannot call an aggregate function within an aggregate function"},
    {"errCHARREQD",         "42000", "char/wchar type is required"},
    {"errCONNECT",          "08001", "unable to connect"},
    {"errLOCKSFREED",       "25000", "cursor's read locks freed by intervening commit/rollback"},
    {"errINVTRID",          "RX027", "invalid transaction id"},
    {"errUNIONOPEN",        "42000", "db union open invalid when other database is open"},
    {"errDBUNAVAIL",        "42000", "database unavailable due to exclusive access rules"},
    {"errDBOPEN",           "42000", "database has already been opened"},
    {"errRDONLYDB",         "42000", "database is opened for read only"},
    {"errNOBLOBSORT",       "42000", "sorting on a blob column is not allowed"},
    {"errNOBLOBGROUP",      "42000", "blob columns cannot be referenced in a SELECT with GROUP BY"},
    {"errINVARGTYPE",       "HY009", "invalid argument type"},
    {"errDIFFCONNS",        "42000", "statements from different connections"},
    {"errOUTERJOIN",        "42000", "unable to process outer join specification"},
    {"errSHOWPLAN",         "42000", "invalid access--use rsqlShowPlan/SQLShowPlan function"},
    {"errQUERYUDF",         "42000", "query() cannot be used in SELECT result column"},
    {"errVTACCESS",         "42000", "virtual table access restricted to INSERT or SELECT"},
    {"errVTSPACE",          "42000", "out of space in virtual table"},
    {"errNOWHEREBLOB",      "42000", "blob columns cannot be used in WHERE clause of a SELECT with ORDER BY"},
    {"errINVTYPEMAP",       "42000", "invalid data type mapping"},
    {"errNAMEDPARAM",       "07009", "named parameter not found"},
    {"errUNUSED000",        "RX999", "unused error code"},
    {"errDBACTIVE",         "RX029", "database is currently in use"},
    {"errDBINUSE",          "RX030", "database is being used by other task(s)/user(s)"},
    {"errNOTINUDF",         "42000", "function cannot be called from a UDF"},
    {"errCOREDBOPEN",       "42000", "database not opened - use read-only mode to open core databases"},
    {"errCATVERSION",       "RX031", "incompatible catalog version"}, 
    {"errONCLAUSE",         "42000", "ON condition only allows equi-join predicates"}, 
    {"errGROUPRESULT",      "42000", "result column must have aggregate function call"},
    {"errDOCROOTUSED",      "08001", "the specified DOCROOT is already in use"},
    {"errNOVTENTRY",        "42000", "no registered function interface for virtual table"},
    {"errNOVTSINDB",        "42000", "database does not contain any virtual tables"},
    {"errINVCURSOR",        "34000", "invalid cursor name"},
    {"errCURSORTAB",        "0T000", "target table does not match cursor specification"},
    {"errFORUPDCOL",        "42000", "FOR UPDATE column not in SELECT list"},
    {"errINVPROC",          "RX032", "stored procedure has an invalid version"},
    {"errNOTUDFAGG",        "42000", "distinct can only be specified with aggregate UDF"},
    {"errNODBTABLES",       "42000", "database does not contain any tables"},
    {"errDDLKEYWORD",       "42000", "core DDL keyword cannot be used in SQL DDL"},
    {"errINVFILETYPE",      "42000", "invalid import/export file type"},
    {"errSLAVEREADONLY",    "42000", "a slave database can only be opened in readonly mode"},
    {"errBADROWIDCOL",      "42000", "rowid columns can only be declared as primary or foreign keys"},
    {"errINVROWIDVAL",      "42000", "invalid rowid value"},
    {"errNOINSERTID",       "42000", "no last_insert_id is available"},
    {"errINVSELECT",        "42000", "SELECT cannot have ORDER/GROUP BY clause"},
    {"errROWIDCASCADE",     "42000", "ON UPDATE CASCADE not allowed on rowid primary key references"},
    {"errUPDROWIDPK",       "42000", "UPDATE of rowid primary key column is now allowed"},
    {"errDUPALIAS",         "42S21", "duplicate table aliases"},
    {"errUPDSTATSACTIVE",   "42000", "another update stats is already active"},
    {"errGROUPBYPARMS",     "42000", "GROUP BY column expressions cannot have parameter markers"},
    {"errINVARMISMATCH",    "42000", "Variant argument value in INVAR aggregate function"},
    {"errBADFCNARG",        "42000", "bad function argument"},
    {"errBADWILDALL",       "42000", "bad wild all character (must be '%' or '*')"},
    {"errBADWILDONE",       "42000", "bad wild one character (must be '_', '.', or '?')"},
    {"errSORTCOST",         "42000", "sort cost factor must be > 0.0 and < 1.0"},
    {"errCACHESIZE",        "42000", "cache size setting must be >= 100"},
    {"errDEBUGMODE",        "42000", "valid debug mode values are 0,1,2,3"},
    {"errBADPREC",          "42000", "invalid DECIMAL precision. Must be > 0 and <= 32"},
    {"errBADSCALE",         "42000", "invalid DECIMAL scale. Must be >= 0 and <= prec"},
    {"errOVERFLOW",         "42000", "DECIMAL value overflow"},
    {"errDEFAUTO",          "42000", "DEFAULT AUTO is only allowed with guid data types"},
    {"errBADGUID",          "42000", "invalid UUID/GUID value"},
    {"errDEFBINLEN",        "42000", "binary DEFAULT value not correct length"},
    {"errINVTASK",          "42000", "invalid task ID"},
    {"errINVENCTYPE",       "42000", "invalid encryption type"},
    {"errUNSUPENCTYPE",     "42000", "unsupported encryption type"},
    {"errNOENCKEY",         "42000", "encryption key not found"},
    {"errVTRESTRICTED",     "42000", "virtual table access restricted to one active hstmt per hconn"},
    {"errTBD",              "RX028", "yet to be implemented feature"}, /* leave as next to last entry */
    {"errSYSTEM",           "RX999", "system error"} /* must be last entry in table */
    /* GENERROREND */
};

#endif  /* __ERRTAB_H */
