00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef RESOURCEPOOL_SQL_SQLException_HH
00025 #define RESOURCEPOOL_SQL_SQLException_HH
00026
00027 #ifndef INCLUDED_EXCEPTIONS_HH
00028 #include "Exceptions/Exception.hh"
00029 #endif
00030
00031 namespace fatalmind {
00032 namespace SQL {
00033
00037 class SQLException: virtual public Exception {
00038 public:
00039 SQLException(const std::string& msg
00040 , const std::string& sqlstate
00041 , const std::string& sqlstm
00042 , const bool failover
00043 ):Exception(msg)
00044 , _sqlstate(sqlstate)
00045 , _sqlstm(sqlstm)
00046 , _failover(failover)
00047 {
00048 }
00049
00050 const std::string& getSQL() const throw() {
00051 return _sqlstm;
00052 }
00053
00054 bool isFailover() const throw() {
00055 return _failover;
00056 }
00057
00058 const std::string& getSQLState() const throw() {
00059 return _sqlstate;
00060 }
00061
00062 bool isSQLState(const char* const c) const {
00063 return !_sqlstate.compare(c);
00064 }
00065
00066 const std::string getSQLStateClass() const {
00067 return _sqlstate.substr(0,2);
00068 }
00069
00070 bool isSQLStateClass(const std::string& c) const {
00071 return !_sqlstate.compare(0, 2, c, 0, 2);
00072 }
00073
00074 bool isSQLStateClass(const char* const c) const {
00075 return !_sqlstate.compare(0, 2, c, 0, 2);
00076 }
00077
00078 private:
00079 const std::string _sqlstate;
00080 const std::string _sqlstm;
00081 const bool _failover;
00082 };
00083
00084 };
00085 };
00086
00087 #endif