00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef ODBCPP_DIAG
00027 #define ODBCPP_DIAG
00028
00029 namespace odbcpp
00030 {
00031
00032 class diag_t
00033 {
00034 public:
00035 diag_t();
00036
00037 std::string f_server;
00038 std::string f_connection;
00039 std::string f_message;
00040 std::string f_odbc_state;
00041 SQLINTEGER f_native_errno;
00042 };
00043 typedef std::vector<diag_t> diag_vector_t;
00044
00045
00046
00047 class diagnostic
00048 {
00049 public:
00050 diag(const std::string& message);
00051 diag(SQLSMALLINT handle_type, SQLHANLE handle);
00052
00053 SQLSMALLINT size() const { return f_diag.size(); }
00054 diag_t get(SQLSMALLINT record) const { return f_diag[static_cast<int>(record) - 1]; }
00055 diag_t operator [] (int record) const { return f_diag[record - 1]; }
00056
00057 static bool get_string(SQLSMALLINT handle_type, SQLHANLE handle, SQLSMALLINT record, SQLSMALLINT identifier, std::string& string);
00058 static bool get_integer(SQLSMALLINT handle_type, SQLHANLE handle, SQLSMALLINT record, SQLSMALLINT identifier, SQLINTEGER& integer);
00059
00060 private:
00061 diag_vector_t f_diag;
00062 };
00063
00064
00065
00066 }
00067
00068
00069 #endif // #ifndef ODBCPP_DIAG