fix for trie index
[csql.git] / src / odbc / odbcError.h
blob9a6cf591b70ad82d12ea4b876e0a446761eeda49
1 #ifndef _ODBC_ERROR_H_
2 #define _ODBC_ERROR_H_
4 class CSqlOdbcError
5 {
6 CSqlOdbcError( void );
8 public:
9 // This object belongs to.
10 int hdlType;
11 //Record Count
12 int count;
13 // SQLAPI specific err code.
14 SQLINTEGER csqlErrCode;
16 // ODBC Methods
17 SQLRETURN SQLGetDiagRec(
18 SQLHANDLE hdl,
19 SQLCHAR *sqlState,
20 SQLINTEGER *csqlErrCode,
21 SQLCHAR *Msg,
22 SQLSMALLINT bufLen,
23 SQLSMALLINT *textLen);
25 // Other Methods
26 CSqlOdbcError( long hdlType );
27 void set( long err );
28 SQLRETURN printStr( SQLUINTEGER odbcVersion );
29 // Print diagnostic info to 'stderr'
30 static void printDbg( char *msg );
31 };
33 extern CSqlOdbcError globalError;
35 typedef struct ErrorDetails
37 public:
38 int csqlErrCode;
39 SQLCHAR *sqlState;
40 SQLCHAR *sqlMessage;
41 } ErrorInfo_t;
43 // Native Error Codes
44 #define NO_ERR -0L
45 #define ERROR_GEN_WARN -1L
46 #define ERROR_GENERAL -2L
47 #define ERROR_OPTFEATURE_NOTIMP -3L
49 //Connection Related
50 #define ERROR_HOSTNAME -4L
51 #define ERROR_PORTNO -5L
52 #define ERROR_CONNREJCTD -6L
53 #define ERROR_INVAUTHSPEC -7L
54 #define ERROR_CONN_TIMEOUT_EXP -8L
55 #define ERROR_DESTIP_REJ -9L
56 #define ERROR_SRCIP_REJ -10L
57 #define ERROR_CONNINUSE -11L
58 #define ERROR_CONNOTOPEN -12L
59 #define ERROR_NOTOPENED -13L
61 //Transaction Related
62 #define ERROR_INVTRANSTATE -14L
63 #define ERROR_TRANROLLBACK -15L
65 //Statement Related
66 #define ERROR_SCHNOTFOUND -16L
67 #define ERROR_TBLNOTFOUND -17L
68 #define ERROR_NO_COLEXISTS -18L
69 #define ERROR_NO_IDXEXISTS -19L
71 #define ERROR_TBLEXISTS -20L
72 #define ERROR_COLEXISTS -21L
73 #define ERROR_IDXEXISTS -22L
75 #define ERROR_MANY_VALS -23L
76 #define ERROR_FEW_VALS -24L
77 #define ERROR_SQL_SYNTAX -25L
78 #define ERROR_TYPE_INCMP -26L
79 #define ERROR_DATA_FORMAT -27L
80 #define ERROR_DUP_COL -28L
82 #define ERROR_SQL_INT -29L
83 #define ERROR_OVERFLOW -30L
84 #define ERROR_UNDERFLOW -31L
85 #define ERROR_MANY_TUP -32L
86 #define ERROR_NUM_PROJ -33L
88 #define ERROR_DATATRUNC -34L
89 #define ERROR_BUFLEN -35L
90 #define ERROR_COLNUM -36L
91 #define ERROR_INVBUFTYPE -37L
92 #define ERROR_INV_PARAMTYPE -38L
93 #define ERROR_INVARGVAL -39L
95 #define ERROR_CURNAME -40L
96 #define ERROR_DUP_CURNAME -41L
97 #define ERROR_NOCURNAME -42L
98 #define ERROR_PARAMNUM -43L
100 //Memory Related
101 #define ERROR_MEM_MGMNT -44L
102 #define ERROR_MEMALLOC -45L
104 //DBC Related
105 #define ERROR_OPTRANGE -46L
106 #define ERROR_OPTCHANGE -47L
107 #define ERROR_FUNCSEQ -48L
108 #define ERROR_ATTR_CANNOT_SET -49L
109 #define ERROR_INVCURSTATE -50L
110 #define ERROR_NOT_PREPAREDSTMT -51L
112 //CREAT TABLE
113 #define ERROR_STORAGE_ATTR -53L
114 #define ERROR_FLDCNT_MISMATCH -54L
115 #define ERROR_MATCHKEY_NOTFOUND -55L
117 #define ERROR_ENDOFTABLE -56L
119 static ErrorInfo_t errorInfoTable_3x [] =
121 { NO_ERR, (SQLCHAR *)("00000"), (SQLCHAR *)("Success") },
123 { ERROR_GEN_WARN,(SQLCHAR *)("01000"),(SQLCHAR *)("General Warning")},
125 { ERROR_GENERAL,(SQLCHAR *)("HY000"), (SQLCHAR *)("General Error3") },
127 { ERROR_OPTFEATURE_NOTIMP,(SQLCHAR *)("HYC00"), (SQLCHAR *)("Optional feature not implemented") },
129 { ERROR_HOSTNAME,(SQLCHAR *)("SC002"), (SQLCHAR *)("Hostname must be specified") },
131 { ERROR_PORTNO,(SQLCHAR *)("SC003"), (SQLCHAR *)("Port number must be specified") },
133 { ERROR_CONNREJCTD, (SQLCHAR *)("08006"), (SQLCHAR *)("Server rejected the connection") },
135 { ERROR_INVAUTHSPEC,(SQLCHAR *)("28000"), (SQLCHAR *)("Invalid authorization specification") },
137 { ERROR_CONN_TIMEOUT_EXP,(SQLCHAR *)("SC001"), (SQLCHAR *)("Connection timeout expired") },
139 { ERROR_DESTIP_REJ,(SQLCHAR *)("08004"), (SQLCHAR *)("IPFilter: Destination IP validation failed.") },
141 { ERROR_SRCIP_REJ, (SQLCHAR *)("08005"), (SQLCHAR *)("IPFilter: Source IP validation failed.") },
143 { ERROR_CONNINUSE,(SQLCHAR *)("08001"), (SQLCHAR *)("Connection name in use") },
145 { ERROR_CONNOTOPEN,(SQLCHAR *)("08003"), (SQLCHAR *)("Connection does not exist") },
147 { ERROR_NOTOPENED,(SQLCHAR *)("08002"), (SQLCHAR *)("Connection does not exist") },
149 { ERROR_INVTRANSTATE,(SQLCHAR *)("TR005"), (SQLCHAR *)("Invalid transaction state") },
151 { ERROR_TRANROLLBACK,(SQLCHAR *)("25002"), (SQLCHAR *)("Transaction is rolled back") },
153 { ERROR_SCHNOTFOUND,(SQLCHAR *)("3F000"), (SQLCHAR *)("Schema not found.") },
155 { ERROR_TBLNOTFOUND, (SQLCHAR *)("42S02"), (SQLCHAR *)("Base Table or view not found") },
157 { ERROR_NO_COLEXISTS,(SQLCHAR *)("42S22"), (SQLCHAR *)("Column not found ") },
159 { ERROR_NO_IDXEXISTS,(SQLCHAR *)("42S12"), (SQLCHAR *)("Index not found ") },
161 { ERROR_TBLEXISTS,(SQLCHAR *)("42S01"), (SQLCHAR *)("Base Table or view already exists") },
163 { ERROR_COLEXISTS,(SQLCHAR *)("42S21"), (SQLCHAR *)("Column already exists ") },
165 { ERROR_IDXEXISTS,(SQLCHAR *)("42S11"), (SQLCHAR *)("Index already exists") },
167 { ERROR_MANY_VALS,(SQLCHAR *)("ST018"), (SQLCHAR *)("Too many values supplied in insert statement") },
169 { ERROR_FEW_VALS, (SQLCHAR *)("ST019"), (SQLCHAR *)("Too few values supplied in insert statement") },
171 { ERROR_SQL_SYNTAX,(SQLCHAR *)("ST026"), (SQLCHAR *)("Syntax error.") },
173 { ERROR_TYPE_INCMP,(SQLCHAR *)("ST020"), (SQLCHAR *)("In-Compatible column value") },
175 { ERROR_DATA_FORMAT,(SQLCHAR *)("ST021"), (SQLCHAR *)("Invalid value/format") },
177 { ERROR_DUP_COL,(SQLCHAR *)("ST024"), (SQLCHAR *)("Duplicate field names") },
179 { ERROR_SQL_INT,(SQLCHAR *)("ST025"), (SQLCHAR *)("SQL internal error") },
181 { ERROR_OVERFLOW,(SQLCHAR *)("ST023"), (SQLCHAR *)("Underflow error") },
183 { ERROR_UNDERFLOW,(SQLCHAR *)("ST022"), (SQLCHAR *)("Overflow error") },
185 { ERROR_MANY_TUP,(SQLCHAR *)("ST027"), (SQLCHAR *)("Sub query returns multiple rows") },
187 { ERROR_NUM_PROJ,(SQLCHAR *)("ST028"), (SQLCHAR *)("Wrong number of projections from sub query") },
189 { ERROR_DATATRUNC,(SQLCHAR *)("01004"), (SQLCHAR *)("String data,right truncated") },
191 { ERROR_BUFLEN,(SQLCHAR *)("HY090"), (SQLCHAR *)("Invalid string or buffer length") },
193 { ERROR_COLNUM,(SQLCHAR *)("07009"), (SQLCHAR *)("Invalid descriptor index") },
195 { ERROR_INVBUFTYPE,(SQLCHAR *)("HY003"), (SQLCHAR *)("Invalid application buffer type") },
197 { ERROR_INV_PARAMTYPE,(SQLCHAR *)("HY105"), (SQLCHAR *)("Invalid parameter type") },
199 { ERROR_INVARGVAL,(SQLCHAR *)("HY024"), (SQLCHAR *)("Invalid attribute value") },
201 { ERROR_CURNAME,(SQLCHAR *)("34000"), (SQLCHAR *)("Invalid cursor name") },
203 { ERROR_DUP_CURNAME,(SQLCHAR *)("3C000"), (SQLCHAR *)("Duplicate cursor name") },
205 { ERROR_NOCURNAME,(SQLCHAR *)("HY015"), (SQLCHAR *)("No cursor name available") },
207 { ERROR_PARAMNUM,(SQLCHAR *)("07009"), (SQLCHAR *)("Invalid descriptor index") },
209 { ERROR_MEM_MGMNT,(SQLCHAR *)("HY013"), (SQLCHAR *)("Memory management error ") },
211 { ERROR_MEMALLOC, (SQLCHAR *)("HY001"), (SQLCHAR *)("Memory Allocation Failure") },
213 { ERROR_OPTRANGE,(SQLCHAR *)("HY092"), (SQLCHAR *)("Invalid attribute /option identifier") },
215 { ERROR_OPTCHANGE,(SQLCHAR *)("01S02"), (SQLCHAR *)("Option value changed")},
217 { ERROR_FUNCSEQ,(SQLCHAR *)("HY010"), (SQLCHAR *)("Function Sequence Error") },
219 { ERROR_ATTR_CANNOT_SET,(SQLCHAR *)("HY011"), (SQLCHAR *)("Attribute cannot be set now ") },
221 { ERROR_INVCURSTATE,(SQLCHAR *)("24000"), (SQLCHAR *)("Invalid cursor state") },
223 { ERROR_NOT_PREPAREDSTMT,(SQLCHAR *)("HY007"), (SQLCHAR *)("Associated statement is not prepared")},
225 { ERROR_STORAGE_ATTR,(SQLCHAR *)("ST029"), (SQLCHAR *)("Error while parsing storage attribute")},
227 { ERROR_FLDCNT_MISMATCH,(SQLCHAR *)("ST030"), (SQLCHAR *)("Error while creating RIC, specified in to-from table are different")},
229 { ERROR_ENDOFTABLE,(SQLCHAR *)("IM015"), (SQLCHAR *)("End of table") }
232 static ErrorInfo_t errorInfoTable_2x [] =
234 { NO_ERR, (SQLCHAR *)("00000"), (SQLCHAR *)("Success") },
236 { ERROR_GEN_WARN, (SQLCHAR *)("01000"),(SQLCHAR *)("General Warning")},
238 { ERROR_GENERAL, (SQLCHAR *)("S1000"), (SQLCHAR *)("General Error") },
240 { ERROR_OPTFEATURE_NOTIMP, (SQLCHAR *)("S1C00"), (SQLCHAR *)("Optional feature not implemented") },
242 { ERROR_HOSTNAME, (SQLCHAR *)("HY000"), (SQLCHAR *)("Hostname must be specified") },
244 { ERROR_PORTNO, (SQLCHAR *)("HY000"), (SQLCHAR *)("Port number must be specified") },
246 { ERROR_CONNREJCTD, (SQLCHAR *)("08004"), (SQLCHAR *)("Data source rejected establishment of connection") },
248 { ERROR_INVAUTHSPEC,(SQLCHAR *)("28000"), (SQLCHAR *)("Invalid authorization specification") },
250 { ERROR_CONN_TIMEOUT_EXP,(SQLCHAR *)("S1T01"), (SQLCHAR *)("Connection timeout expired") },
252 { ERROR_DESTIP_REJ,(SQLCHAR *)("08004"), (SQLCHAR *)("IPFilter: Destination IP validation failed.") },
254 { ERROR_SRCIP_REJ, (SQLCHAR *)("08005"), (SQLCHAR *)("IPFilter: Source IP validation failed.") },
256 { ERROR_CONNINUSE,(SQLCHAR *)("08002"), (SQLCHAR *)("Connection in use") },
258 { ERROR_CONNOTOPEN,(SQLCHAR *)("08003"), (SQLCHAR *)("Connection not open") },
260 { ERROR_NOTOPENED, (SQLCHAR *)("08003"), (SQLCHAR *)("Connection not open") },
262 { ERROR_INVTRANSTATE,(SQLCHAR *)("25000"), (SQLCHAR *)("Invalid transaction state") },
264 { ERROR_TRANROLLBACK,(SQLCHAR *)("25S03"), (SQLCHAR *)("Transaction is rolled back") },
266 { ERROR_SCHNOTFOUND,(SQLCHAR *)("3F000"), (SQLCHAR *)("Schema not found.") },
268 { ERROR_TBLNOTFOUND,(SQLCHAR *)("S0002"), (SQLCHAR *)("Base Table or view not found") },
270 { ERROR_NO_COLEXISTS,(SQLCHAR *)("S0022"), (SQLCHAR *)("Column not found ") },
272 { ERROR_NO_IDXEXISTS,(SQLCHAR *)("42S12"), (SQLCHAR *)("Index not found ") },
274 { ERROR_TBLEXISTS,(SQLCHAR *)("S0001"), (SQLCHAR *)("Base Table or view already exists") },
276 { ERROR_COLEXISTS,(SQLCHAR *)("S0021"), (SQLCHAR *)("Column already exists ") },
278 { ERROR_IDXEXISTS,(SQLCHAR *)("S0011"), (SQLCHAR *)("Index already exists") },
280 { ERROR_MANY_VALS,(SQLCHAR *)("ST018"), (SQLCHAR *)("Too many values supplied in insert statement") },
282 { ERROR_FEW_VALS,(SQLCHAR *)("ST019"), (SQLCHAR *)("Too few values supplied in insert statement") },
284 { ERROR_SQL_SYNTAX,(SQLCHAR *)("ST026"), (SQLCHAR *)("Syntax error.") },
286 { ERROR_TYPE_INCMP,(SQLCHAR *)("ST020"), (SQLCHAR *)("In-Compatible column value") },
288 { ERROR_DATA_FORMAT,(SQLCHAR *)("ST021"), (SQLCHAR *)("Invalid value/format") },
290 { ERROR_DUP_COL,(SQLCHAR *)("ST024"), (SQLCHAR *)("Duplicate field names") },
292 { ERROR_SQL_INT,(SQLCHAR *)("ST025"), (SQLCHAR *)("SQL internal error") },
294 { ERROR_OVERFLOW,(SQLCHAR *)("ST023"), (SQLCHAR *)("Underflow error") },
296 { ERROR_UNDERFLOW,(SQLCHAR *)("ST022"), (SQLCHAR *)("Overflow error") },
298 { ERROR_MANY_TUP,(SQLCHAR *)("ST027"), (SQLCHAR *)("Sub query returns multiple rows") },
300 { ERROR_NUM_PROJ,(SQLCHAR *)("ST028"), (SQLCHAR *)("Wrong number of projections from sub query") },
302 { ERROR_DATATRUNC,(SQLCHAR *)("01004"), (SQLCHAR *)("String data,right truncated") },
304 { ERROR_BUFLEN,(SQLCHAR *)("S1090"), (SQLCHAR *)("Invalid string or buffer length") },
306 { ERROR_COLNUM, (SQLCHAR *)("S1000"), (SQLCHAR *)("Invalid column number") },
308 { ERROR_INVBUFTYPE,(SQLCHAR *)("S1003"), (SQLCHAR *)("Invalid application buffer type") },
310 { ERROR_INV_PARAMTYPE,(SQLCHAR *)("S1105"), (SQLCHAR *)("Invalid parameter type") },
312 { ERROR_INVARGVAL,(SQLCHAR *)("S1009"), (SQLCHAR *)("Invalid argument value") },
314 { ERROR_CURNAME,(SQLCHAR *)("34000"), (SQLCHAR *)("Invalid cursor name") },
316 { ERROR_DUP_CURNAME,(SQLCHAR *)("3C000"), (SQLCHAR *)("Duplicate cursor name") },
318 { ERROR_NOCURNAME,(SQLCHAR *)("S1015"), (SQLCHAR *)("No cursor name available") },
320 { ERROR_PARAMNUM,(SQLCHAR *)("S1093"), (SQLCHAR *)("Invalid parameter number") },
322 { ERROR_MEM_MGMNT,(SQLCHAR *)("S1013"), (SQLCHAR *)("Memory management error ") },
324 { ERROR_MEMALLOC,(SQLCHAR *)("S1001"), (SQLCHAR *)("Memory Allocation Failure") },
326 { ERROR_OPTRANGE,(SQLCHAR *)("S1092"), (SQLCHAR *)("Option type out of range") },
328 { ERROR_OPTCHANGE,(SQLCHAR *)("01S02"), (SQLCHAR *)("Option value changed")},
330 { ERROR_FUNCSEQ,(SQLCHAR *)("S1010"), (SQLCHAR *)("Function Sequence Error") },
332 { ERROR_ATTR_CANNOT_SET,(SQLCHAR *)("S1011"), (SQLCHAR *)("Attribute cannot be set now ") },
334 { ERROR_INVCURSTATE, (SQLCHAR *)("24000"), (SQLCHAR *)("Invalid cursor state") },
336 { ERROR_NOT_PREPAREDSTMT, (SQLCHAR *)("S1010"), (SQLCHAR *)("Associated statement is not prepared")},
338 { ERROR_STORAGE_ATTR,(SQLCHAR *)("ST029"), (SQLCHAR *)("Error while parsing storage attribute")},
340 { ERROR_FLDCNT_MISMATCH,(SQLCHAR *)("ST030"), (SQLCHAR *)("Error while creating RIC, specified in to-from table are different")},
342 { ERROR_MATCHKEY_NOTFOUND,(SQLCHAR *) ("ST031"), (SQLCHAR *) ("Referenced key is not Primary/Unique")},
344 { ERROR_ENDOFTABLE,(SQLCHAR *)("IM015"), (SQLCHAR *)("End of table") }
347 #endif