include/odbcpp/diag.h

Go to the documentation of this file.
00001 //
00002 // File:        include/odbcpp/diag.h
00003 // Object:      Define the exception objects of the odbcpp library
00004 //
00005 // Copyright (C)   2008 Made to Order Software Corp.
00006 //
00007 // This program is free software; you can redistribute it and/or modify
00008 // it under the terms of the GNU General Public License as published by
00009 // the Free Software Foundation; either version 2 of the License, or
00010 // (at your option) any later version.
00011 //
00012 // This program is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with this program; if not, write to:
00019 //
00020 //   Free Software Foundation, Inc.
00021 //   51 Franklin St, Fifth Floor
00022 //   Boston, MA  02110-1301
00023 //   USA
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 }       // namespace odbcpp
00067 
00068 
00069 #endif          // #ifndef ODBCPP_DIAG

Generated on Sat May 31 22:23:22 2008 for odbcpp by  doxygen 1.4.7