#include "include.hpp"#include <sql.h>#include "error.hpp"Go to the source code of this file.
Functions | |
| void | odbcWrap (SQLRETURN success, SQLSMALLINT handleType, SQLHANDLE handle) throw (Error) |
| void odbcWrap | ( | SQLRETURN | success, | |
| SQLSMALLINT | handleType, | |||
| SQLHANDLE | handle | |||
| ) | throw (Error) |
Extract error information, if method call was unsuccessful.
Definition at line 21 of file odbcWrap.cpp.
References ERRORMACRO.
00023 { 00024 if ( !SQL_SUCCEEDED( success ) ) { 00025 if ( handleType != SQL_NULL_HANDLE ) { 00026 SQLCHAR sqlStatus[10]; 00027 SQLINTEGER error; 00028 SQLSMALLINT length; 00029 SQLCHAR message[4096]; 00030 SQLGetDiagRec( handleType, handle, 1, sqlStatus, &error, message, 00031 sizeof(message), &length ); 00032 #ifndef NDEBUG 00033 cerr << (const char *)&message << endl; 00034 #endif 00035 ERRORMACRO( false, Error, , "Could not allocate ODBC handle: " 00036 << (const char *)&message ); 00037 } else 00038 ERRORMACRO( false, Error, , "Error allocating ODBC handle" ); 00039 }; 00040 }