00001
00002 #if !defined(__INC_EXCEPTION_H)
00003 #define __INC_EXCEPTION_H
00004
00005 #include <stdexcept>
00006
00007 namespace GQL
00008 {
00009
00010 class SQLException : public std::runtime_error
00011 {
00012 public:
00013 SQLException(const std::string& str = std::string(),
00014 const std::string& state = std::string(),
00015 int err = 0)
00016 : runtime_error(str), state_(state), vendor_code_(err) { }
00017 virtual ~SQLException() throw() { }
00018
00019 const char *get_message() const { return(what()); }
00020 int get_error_code() const { return(vendor_code_); }
00021 const std::string& get_sql_state() const { return(state_); }
00022 private:
00023 std::string state_;
00024 int vendor_code_;
00025 };
00026
00027 }
00028
00029 #endif