src/odbc/odbcError.h

Go to the documentation of this file.
00001 #ifndef _ODBC_ERROR_H_
00002 #define _ODBC_ERROR_H_
00003 
00004 class CSqlOdbcError
00005 {
00006         CSqlOdbcError( void );     
00007 
00008     public:
00009         // This object belongs to.
00010         int    hdlType; 
00011 
00012         // SQLAPI specific err code.
00013         SQLINTEGER    csqlErrCode;
00014 
00015         // ODBC Methods
00016         SQLRETURN SQLGetDiagRec(
00017             SQLHANDLE    hdl,
00018             SQLCHAR      *sqlState,
00019             SQLINTEGER   *csqlErrCode,
00020             SQLCHAR      *Msg,
00021             SQLSMALLINT  bufLen,
00022             SQLSMALLINT  *textLen);
00023 
00024         // Other Methods
00025         CSqlOdbcError( long hdlType );
00026         void set( long err );
00027         SQLRETURN printStr( SQLUINTEGER odbcVersion ); 
00028         // Print diagnostic info to 'stderr'
00029         static void printDbg( char *msg );
00030 };
00031 
00032 extern CSqlOdbcError globalError;
00033 
00034 typedef struct ErrorDetails
00035 {
00036     public:
00037         int         csqlErrCode;
00038         SQLCHAR     *sqlState;
00039         SQLCHAR     *sqlMessage;
00040 } ErrorInfo_t;
00041 
00042 // Native Error Codes
00043 #define NO_ERR                      -0L
00044 #define ERROR_GEN_WARN              -1L
00045 #define ERROR_GENERAL               -2L
00046 #define ERROR_OPTFEATURE_NOTIMP     -3L
00047 
00048 //Connection Related
00049 #define ERROR_HOSTNAME              -4L
00050 #define ERROR_PORTNO                -5L
00051 #define ERROR_CONNREJCTD            -6L
00052 #define ERROR_INVAUTHSPEC           -7L
00053 #define ERROR_CONN_TIMEOUT_EXP      -8L
00054 #define ERROR_DESTIP_REJ            -9L
00055 #define ERROR_SRCIP_REJ             -10L
00056 #define ERROR_CONNINUSE             -11L
00057 #define ERROR_CONNOTOPEN            -12L
00058 #define ERROR_NOTOPENED             -13L
00059 
00060 //Transaction Related
00061 #define ERROR_INVTRANSTATE          -14L
00062 #define ERROR_TRANROLLBACK          -15L
00063 
00064 //Statement Related
00065 #define ERROR_SCHNOTFOUND           -16L
00066 #define ERROR_TBLNOTFOUND           -17L
00067 #define ERROR_NO_COLEXISTS          -18L
00068 #define ERROR_NO_IDXEXISTS          -19L
00069 
00070 #define ERROR_TBLEXISTS             -20L
00071 #define ERROR_COLEXISTS             -21L
00072 #define ERROR_IDXEXISTS             -22L
00073 
00074 #define ERROR_MANY_VALS             -23L
00075 #define ERROR_FEW_VALS              -24L
00076 #define ERROR_SQL_SYNTAX            -25L
00077 #define ERROR_TYPE_INCMP            -26L
00078 #define ERROR_DATA_FORMAT           -27L
00079 #define ERROR_DUP_COL               -28L
00080 
00081 #define ERROR_SQL_INT               -29L
00082 #define ERROR_OVERFLOW              -30L
00083 #define ERROR_UNDERFLOW             -31L
00084 #define ERROR_MANY_TUP              -32L
00085 #define ERROR_NUM_PROJ              -33L
00086 
00087 #define ERROR_DATATRUNC             -34L
00088 #define ERROR_BUFLEN                -35L
00089 #define ERROR_COLNUM                -36L
00090 #define ERROR_INVBUFTYPE            -37L
00091 #define ERROR_INV_PARAMTYPE         -38L
00092 #define ERROR_INVARGVAL             -39L
00093 
00094 #define ERROR_CURNAME               -40L
00095 #define ERROR_DUP_CURNAME           -41L
00096 #define ERROR_NOCURNAME             -42L
00097 #define ERROR_PARAMNUM              -43L
00098  
00099 //Memory Related
00100 #define ERROR_MEM_MGMNT             -44L
00101 #define ERROR_MEMALLOC              -45L
00102 
00103 //DBC Related
00104 #define ERROR_OPTRANGE              -46L
00105 #define ERROR_OPTCHANGE             -47L
00106 #define ERROR_FUNCSEQ               -48L
00107 #define ERROR_ATTR_CANNOT_SET       -49L
00108 #define ERROR_INVCURSTATE           -50L
00109 #define ERROR_NOT_PREPAREDSTMT      -51L
00110 
00111 //CREAT TABLE
00112 #define ERROR_STORAGE_ATTR          -53L
00113 #define ERROR_FLDCNT_MISMATCH       -54L
00114 #define ERROR_MATCHKEY_NOTFOUND     -55L
00115 
00116 #define ERROR_ENDOFTABLE            -56L
00117 
00118 static ErrorInfo_t  errorInfoTable_3x [] = 
00119 {
00120     { NO_ERR, (SQLCHAR *)("00000"), (SQLCHAR *)("Success") },
00121 
00122     { ERROR_GEN_WARN,(SQLCHAR *)("01000"),(SQLCHAR *)("General Warning")},
00123 
00124     { ERROR_GENERAL,(SQLCHAR *)("HY000"), (SQLCHAR *)("General Error3") },
00125 
00126     { ERROR_OPTFEATURE_NOTIMP,(SQLCHAR *)("HYC00"), (SQLCHAR *)("Optional feature not implemented") },
00127     
00128     { ERROR_HOSTNAME,(SQLCHAR *)("SC002"), (SQLCHAR *)("Hostname must be specified") },
00129 
00130     { ERROR_PORTNO,(SQLCHAR *)("SC003"), (SQLCHAR *)("Port number must be specified") },
00131 
00132     { ERROR_CONNREJCTD, (SQLCHAR *)("08006"), (SQLCHAR *)("Server rejected the connection") },
00133 
00134     { ERROR_INVAUTHSPEC,(SQLCHAR *)("28000"), (SQLCHAR *)("Invalid authorization specification") },
00135 
00136     { ERROR_CONN_TIMEOUT_EXP,(SQLCHAR *)("SC001"), (SQLCHAR *)("Connection timeout expired") },
00137 
00138     { ERROR_DESTIP_REJ,(SQLCHAR *)("08004"), (SQLCHAR *)("IPFilter: Destination IP validation failed.") },
00139 
00140     { ERROR_SRCIP_REJ, (SQLCHAR *)("08005"), (SQLCHAR *)("IPFilter: Source IP validation failed.") },
00141 
00142     { ERROR_CONNINUSE,(SQLCHAR *)("08001"), (SQLCHAR *)("Connection name in use") },
00143 
00144     { ERROR_CONNOTOPEN,(SQLCHAR *)("08003"), (SQLCHAR *)("Connection does not exist") },
00145 
00146     { ERROR_NOTOPENED,(SQLCHAR *)("08002"), (SQLCHAR *)("Connection does not exist") },
00147 
00148     { ERROR_INVTRANSTATE,(SQLCHAR *)("TR005"), (SQLCHAR *)("Invalid transaction state") },
00149 
00150     { ERROR_TRANROLLBACK,(SQLCHAR *)("25002"), (SQLCHAR *)("Transaction is rolled back") },
00151 
00152     { ERROR_SCHNOTFOUND,(SQLCHAR *)("3F000"), (SQLCHAR *)("Schema not found.") },
00153 
00154     { ERROR_TBLNOTFOUND, (SQLCHAR *)("42S02"), (SQLCHAR *)("Base Table or view not found") },
00155 
00156     { ERROR_NO_COLEXISTS,(SQLCHAR *)("42S22"), (SQLCHAR *)("Column not found ") },
00157 
00158     { ERROR_NO_IDXEXISTS,(SQLCHAR *)("42S12"), (SQLCHAR *)("Index not found ") },
00159 
00160     { ERROR_TBLEXISTS,(SQLCHAR *)("42S01"), (SQLCHAR *)("Base Table or view already exists") },
00161 
00162     { ERROR_COLEXISTS,(SQLCHAR *)("42S21"), (SQLCHAR *)("Column already exists ") },
00163 
00164     { ERROR_IDXEXISTS,(SQLCHAR *)("42S11"), (SQLCHAR *)("Index already exists") },
00165 
00166     { ERROR_MANY_VALS,(SQLCHAR *)("ST018"), (SQLCHAR *)("Too many values supplied in insert statement") },
00167 
00168     { ERROR_FEW_VALS, (SQLCHAR *)("ST019"), (SQLCHAR *)("Too few values supplied in insert statement") },
00169     
00170     { ERROR_SQL_SYNTAX,(SQLCHAR *)("ST026"), (SQLCHAR *)("Syntax error.") },
00171 
00172     { ERROR_TYPE_INCMP,(SQLCHAR *)("ST020"), (SQLCHAR *)("In-Compatible column value") },
00173 
00174     { ERROR_DATA_FORMAT,(SQLCHAR *)("ST021"), (SQLCHAR *)("Invalid value/format") },
00175     
00176     { ERROR_DUP_COL,(SQLCHAR *)("ST024"), (SQLCHAR *)("Duplicate field names") },
00177 
00178     { ERROR_SQL_INT,(SQLCHAR *)("ST025"), (SQLCHAR *)("SQL internal error") },
00179 
00180     { ERROR_OVERFLOW,(SQLCHAR *)("ST023"), (SQLCHAR *)("Underflow error") },
00181 
00182     { ERROR_UNDERFLOW,(SQLCHAR *)("ST022"), (SQLCHAR *)("Overflow error") },
00183 
00184     { ERROR_MANY_TUP,(SQLCHAR *)("ST027"), (SQLCHAR *)("Sub query returns multiple rows") },
00185 
00186     { ERROR_NUM_PROJ,(SQLCHAR *)("ST028"), (SQLCHAR *)("Wrong number of projections from sub query") },
00187 
00188     { ERROR_DATATRUNC,(SQLCHAR *)("01004"), (SQLCHAR *)("String data,right truncated") },
00189 
00190     { ERROR_BUFLEN,(SQLCHAR *)("HY090"), (SQLCHAR *)("Invalid string or buffer length") },
00191 
00192     { ERROR_COLNUM,(SQLCHAR *)("07009"), (SQLCHAR *)("Invalid descriptor index") },
00193 
00194     { ERROR_INVBUFTYPE,(SQLCHAR *)("HY003"), (SQLCHAR *)("Invalid application buffer type") },
00195 
00196     { ERROR_INV_PARAMTYPE,(SQLCHAR *)("HY105"), (SQLCHAR *)("Invalid parameter type") },
00197 
00198     { ERROR_INVARGVAL,(SQLCHAR *)("HY024"), (SQLCHAR *)("Invalid attribute value") },
00199 
00200     { ERROR_CURNAME,(SQLCHAR *)("34000"), (SQLCHAR *)("Invalid cursor name") },
00201 
00202     { ERROR_DUP_CURNAME,(SQLCHAR *)("3C000"), (SQLCHAR *)("Duplicate cursor name") },
00203 
00204     { ERROR_NOCURNAME,(SQLCHAR *)("HY015"), (SQLCHAR *)("No cursor name available") },
00205 
00206     { ERROR_PARAMNUM,(SQLCHAR *)("07009"), (SQLCHAR *)("Invalid descriptor index") },
00207 
00208     { ERROR_MEM_MGMNT,(SQLCHAR *)("HY013"), (SQLCHAR *)("Memory management error ") },
00209 
00210     { ERROR_MEMALLOC, (SQLCHAR *)("HY001"), (SQLCHAR *)("Memory Allocation Failure") },
00211 
00212     { ERROR_OPTRANGE,(SQLCHAR *)("HY092"), (SQLCHAR *)("Invalid attribute /option identifier") },
00213 
00214     { ERROR_OPTCHANGE,(SQLCHAR *)("01S02"), (SQLCHAR *)("Option value changed")},
00215 
00216     { ERROR_FUNCSEQ,(SQLCHAR *)("HY010"), (SQLCHAR *)("Function Sequence Error") },
00217 
00218     { ERROR_ATTR_CANNOT_SET,(SQLCHAR *)("HY011"), (SQLCHAR *)("Attribute cannot be set now ") },
00219 
00220     { ERROR_INVCURSTATE,(SQLCHAR *)("24000"), (SQLCHAR *)("Invalid cursor state") },
00221 
00222     { ERROR_NOT_PREPAREDSTMT,(SQLCHAR *)("HY007"), (SQLCHAR *)("Associated statement is not prepared")},
00223 
00224     { ERROR_STORAGE_ATTR,(SQLCHAR *)("ST029"), (SQLCHAR *)("Error while parsing storage attribute")},
00225 
00226     { ERROR_FLDCNT_MISMATCH,(SQLCHAR *)("ST030"), (SQLCHAR *)("Error while creating RIC, specified in to-from table are different")},
00227 
00228     { ERROR_ENDOFTABLE,(SQLCHAR *)("IM015"), (SQLCHAR *)("End of table") }
00229 };
00230 
00231 static ErrorInfo_t  errorInfoTable_2x [] = 
00232 {
00233     { NO_ERR, (SQLCHAR *)("00000"), (SQLCHAR *)("Success") },
00234 
00235     { ERROR_GEN_WARN, (SQLCHAR *)("01000"),(SQLCHAR *)("General Warning")},
00236 
00237     { ERROR_GENERAL, (SQLCHAR *)("S1000"), (SQLCHAR *)("General Error") },
00238 
00239     { ERROR_OPTFEATURE_NOTIMP, (SQLCHAR *)("S1C00"), (SQLCHAR *)("Optional feature not implemented") },
00240     
00241     { ERROR_HOSTNAME, (SQLCHAR *)("HY000"), (SQLCHAR *)("Hostname must be specified") },
00242 
00243     { ERROR_PORTNO, (SQLCHAR *)("HY000"), (SQLCHAR *)("Port number must be specified") },
00244 
00245     { ERROR_CONNREJCTD, (SQLCHAR *)("08004"), (SQLCHAR *)("Data source rejected establishment of connection") },
00246 
00247     { ERROR_INVAUTHSPEC,(SQLCHAR *)("28000"), (SQLCHAR *)("Invalid authorization specification") },
00248 
00249     { ERROR_CONN_TIMEOUT_EXP,(SQLCHAR *)("S1T01"), (SQLCHAR *)("Connection timeout expired") },
00250 
00251     { ERROR_DESTIP_REJ,(SQLCHAR *)("08004"), (SQLCHAR *)("IPFilter: Destination IP validation failed.") },
00252 
00253     { ERROR_SRCIP_REJ, (SQLCHAR *)("08005"), (SQLCHAR *)("IPFilter: Source IP validation failed.") },
00254 
00255     { ERROR_CONNINUSE,(SQLCHAR *)("08002"), (SQLCHAR *)("Connection in use") },
00256 
00257     { ERROR_CONNOTOPEN,(SQLCHAR *)("08003"), (SQLCHAR *)("Connection  not open") },
00258 
00259     { ERROR_NOTOPENED, (SQLCHAR *)("08003"), (SQLCHAR *)("Connection not open") },
00260 
00261     { ERROR_INVTRANSTATE,(SQLCHAR *)("25000"), (SQLCHAR *)("Invalid transaction state") },
00262 
00263     { ERROR_TRANROLLBACK,(SQLCHAR *)("25S03"), (SQLCHAR *)("Transaction is rolled back") },
00264 
00265     { ERROR_SCHNOTFOUND,(SQLCHAR *)("3F000"), (SQLCHAR *)("Schema not found.") },
00266 
00267     { ERROR_TBLNOTFOUND,(SQLCHAR *)("S0002"), (SQLCHAR *)("Base Table or view not found") },
00268 
00269     { ERROR_NO_COLEXISTS,(SQLCHAR *)("S0022"), (SQLCHAR *)("Column not found ") },
00270 
00271     { ERROR_NO_IDXEXISTS,(SQLCHAR *)("42S12"), (SQLCHAR *)("Index not found ") },
00272 
00273     { ERROR_TBLEXISTS,(SQLCHAR *)("S0001"), (SQLCHAR *)("Base Table or view already exists") },
00274     
00275     { ERROR_COLEXISTS,(SQLCHAR *)("S0021"), (SQLCHAR *)("Column already exists ") },
00276 
00277     { ERROR_IDXEXISTS,(SQLCHAR *)("S0011"), (SQLCHAR *)("Index already exists") },
00278 
00279     { ERROR_MANY_VALS,(SQLCHAR *)("ST018"), (SQLCHAR *)("Too many values supplied in insert statement") },
00280 
00281     { ERROR_FEW_VALS,(SQLCHAR *)("ST019"), (SQLCHAR *)("Too few values supplied in insert statement") },
00282     
00283     { ERROR_SQL_SYNTAX,(SQLCHAR *)("ST026"), (SQLCHAR *)("Syntax error.") },
00284 
00285     { ERROR_TYPE_INCMP,(SQLCHAR *)("ST020"), (SQLCHAR *)("In-Compatible column value") },
00286 
00287     { ERROR_DATA_FORMAT,(SQLCHAR *)("ST021"), (SQLCHAR *)("Invalid value/format") },
00288     
00289     { ERROR_DUP_COL,(SQLCHAR *)("ST024"), (SQLCHAR *)("Duplicate field names") },
00290 
00291     { ERROR_SQL_INT,(SQLCHAR *)("ST025"), (SQLCHAR *)("SQL internal error") },
00292 
00293     { ERROR_OVERFLOW,(SQLCHAR *)("ST023"), (SQLCHAR *)("Underflow error") },
00294 
00295     { ERROR_UNDERFLOW,(SQLCHAR *)("ST022"), (SQLCHAR *)("Overflow error") },
00296 
00297     { ERROR_MANY_TUP,(SQLCHAR *)("ST027"), (SQLCHAR *)("Sub query returns multiple rows") },
00298 
00299     { ERROR_NUM_PROJ,(SQLCHAR *)("ST028"), (SQLCHAR *)("Wrong number of projections from sub query") },
00300 
00301     { ERROR_DATATRUNC,(SQLCHAR *)("01004"), (SQLCHAR *)("String data,right truncated") },
00302 
00303     { ERROR_BUFLEN,(SQLCHAR *)("S1090"), (SQLCHAR *)("Invalid string or buffer length") },
00304 
00305     { ERROR_COLNUM, (SQLCHAR *)("S1000"), (SQLCHAR *)("Invalid column number") },
00306 
00307     { ERROR_INVBUFTYPE,(SQLCHAR *)("S1003"), (SQLCHAR *)("Invalid application buffer type") },
00308 
00309     { ERROR_INV_PARAMTYPE,(SQLCHAR *)("S1105"), (SQLCHAR *)("Invalid parameter type") },
00310 
00311     { ERROR_INVARGVAL,(SQLCHAR *)("S1009"), (SQLCHAR *)("Invalid argument value") },
00312 
00313     { ERROR_CURNAME,(SQLCHAR *)("34000"), (SQLCHAR *)("Invalid cursor name") },
00314 
00315     { ERROR_DUP_CURNAME,(SQLCHAR *)("3C000"), (SQLCHAR *)("Duplicate cursor name") },
00316 
00317     { ERROR_NOCURNAME,(SQLCHAR *)("S1015"), (SQLCHAR *)("No cursor name available") },
00318 
00319     { ERROR_PARAMNUM,(SQLCHAR *)("S1093"), (SQLCHAR *)("Invalid parameter number") },
00320 
00321     { ERROR_MEM_MGMNT,(SQLCHAR *)("S1013"), (SQLCHAR *)("Memory management error ") },
00322 
00323     { ERROR_MEMALLOC,(SQLCHAR *)("S1001"), (SQLCHAR *)("Memory Allocation Failure") },
00324 
00325     { ERROR_OPTRANGE,(SQLCHAR *)("S1092"), (SQLCHAR *)("Option type out of range") },
00326 
00327     { ERROR_OPTCHANGE,(SQLCHAR *)("01S02"), (SQLCHAR *)("Option value changed")},
00328 
00329     { ERROR_FUNCSEQ,(SQLCHAR *)("S1010"), (SQLCHAR *)("Function Sequence Error") },
00330 
00331     { ERROR_ATTR_CANNOT_SET,(SQLCHAR *)("S1011"), (SQLCHAR *)("Attribute cannot be set now ") },
00332 
00333     { ERROR_INVCURSTATE, (SQLCHAR *)("24000"), (SQLCHAR *)("Invalid cursor state") },
00334 
00335     { ERROR_NOT_PREPAREDSTMT, (SQLCHAR *)("S1010"), (SQLCHAR *)("Associated statement is not prepared")},
00336 
00337     { ERROR_STORAGE_ATTR,(SQLCHAR *)("ST029"), (SQLCHAR *)("Error while parsing storage attribute")},
00338 
00339     { ERROR_FLDCNT_MISMATCH,(SQLCHAR *)("ST030"), (SQLCHAR *)("Error while creating RIC, specified in to-from table are different")},
00340 
00341     { ERROR_MATCHKEY_NOTFOUND,(SQLCHAR *) ("ST031"), (SQLCHAR *) ("Referenced key is not Primary/Unique")},
00342 
00343     { ERROR_ENDOFTABLE,(SQLCHAR *)("IM015"), (SQLCHAR *)("End of table") }
00344 };
00345 
00346 #endif

Generated on Mon Jun 9 22:37:14 2008 for csql by  doxygen 1.4.7