[unixODBC-dev] SAP tests, myodbc native error codes?

Eric Sharkey sharkey at netrics.com
Wed Apr 20 16:23:40 BST 2005


Hi Peter,

I'm starting to work on the SAP tests again.

The first test that my driver fails is the "cola" test.  It seems
to be using this macro to test the success or failure of ODBC
calls.

#define ERROR_CHECK(hstmtx)      if (retcode != SQL_SUCCESS) {\
                           SQLError(henv,\
                                    hdbc,\
                                    hstmtx,\
                                    sqlstate,\
                                    &esq_sql_code,\
                                    error_txt,\
                                    len_error_txt,\
                                    &used_error_txt);\
                           printf(" sqlstate: %s"CRLF, sqlstate);\
                  printf(" esq_sql_code: %d"CRLF, esq_sql_code);\
                  switch (retcode) {\
                  case(100) :\
                          break;\
                  default:\
                     if (esq_sql_code != -6000 && \
                         esq_sql_code != -4004 && \
                         esq_sql_code != 1051  && \
                         esq_sql_code != 1064)\
                          return(16);\
                          break; } }

You can see that it's using the native error codes to determine
when a failure is fatal, and this is clearly not portable across
data sources.

Is there a complete table of MyODBC error codes somewhere?  I found
this link:

http://dev.mysql.com/doc/mysql/en/myodbc-error-codes.html

But none of the numbers in the macro above are listed.

Eric



More information about the unixODBC-dev mailing list