00001 // 00002 // File: include/odbcpp/exception.h 00003 // Object: Define the exception objects of the odbcpp library 00004 // Project: http://www.m2osw.com/odbcpp 00005 // Author: alexis_wilke@sourceforge.net 00006 // 00007 // Copyright (C) 2008 Made to Order Software Corp. 00008 // 00009 // This program is free software: you can redistribute it and/or modify 00010 // it under the terms of the GNU General Public License as published by 00011 // the Free Software Foundation, either version 3 of the License, or 00012 // (at your option) any later version. 00013 // 00014 // This program is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU General Public License 00020 // along with this program. If not, see <http://www.gnu.org/licenses/> 00021 // or <http://gpl3.m2osw.com/>. 00022 // 00023 00024 #ifndef ODBCPP_EXCEPTION 00025 #define ODBCPP_EXCEPTION 00026 00027 #include "diagnostic.h" 00028 #include <stdexcept> 00029 00030 namespace odbcpp 00031 { 00032 00033 00034 00035 class odbcpp_error : public std::runtime_error 00036 { 00037 public: 00039 static const SQLINTEGER ODBCPP_NONE = 0; 00041 static const SQLINTEGER ODBCPP_INTERNAL = 1; 00043 static const SQLINTEGER ODBCPP_NO_DATA = 2; 00045 static const SQLINTEGER ODBCPP_INCORRECT_USE = 3; 00047 static const SQLINTEGER ODBCPP_NOT_IMPLEMENTED = 4; 00049 static const SQLINTEGER ODBCPP_TYPE_MISMATCH = 5; 00051 static const SQLINTEGER ODBCPP_NOT_FOUND = 6; 00052 00053 odbcpp_error(const diagnostic& diag) : 00054 std::runtime_error(diag.msg()), 00055 f_diag(diag) 00056 { 00057 } 00058 00059 diagnostic get() const { return f_diag; } 00060 00061 private: 00062 diagnostic f_diag; 00063 }; 00064 00065 00066 00067 } // namespace odbcpp 00068 00069 00070 #endif // #ifndef ODBCPP_EXCEPTION