CppDB
|
00001 00002 // 00003 // Copyright (C) 2010-2011 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com> 00004 // 00005 // Distributed under: 00006 // 00007 // the Boost Software License, Version 1.0. 00008 // (See accompanying file LICENSE_1_0.txt or copy at 00009 // http://www.boost.org/LICENSE_1_0.txt) 00010 // 00011 // or (at your opinion) under: 00012 // 00013 // The MIT License 00014 // (See accompanying file MIT.txt or a copy at 00015 // http://www.opensource.org/licenses/mit-license.php) 00016 // 00018 #ifndef CPPDB_ERRORS_H 00019 #define CPPDB_ERRORS_H 00020 #include <stdexcept> 00021 #include <string> 00022 00023 namespace cppdb { 00027 class cppdb_error : public std::runtime_error { 00028 public: 00032 cppdb_error(std::string const &v) : std::runtime_error(v) {} 00033 }; 00034 00041 class bad_value_cast : public cppdb_error { 00042 public: 00043 bad_value_cast() : cppdb_error("cppdb::bad_value_cast can't convert data") 00044 { 00045 } 00046 }; 00047 00053 class null_value_fetch : public cppdb_error { 00054 public: 00055 null_value_fetch() : cppdb_error("cppdb::null_value_fetch attempt fetch null column") 00056 { 00057 } 00058 }; 00062 class empty_row_access : public cppdb_error { 00063 public: 00064 empty_row_access() : cppdb_error("cppdb::empty_row_access attempt to fetch from empty column") 00065 { 00066 } 00067 }; 00068 00072 class invalid_column : public cppdb_error { 00073 public: 00074 invalid_column() : cppdb_error("cppdb::invalid_column attempt access to invalid column") 00075 { 00076 } 00077 }; 00081 class invalid_placeholder : public cppdb_error { 00082 public: 00083 invalid_placeholder() : cppdb_error("cppdb::invalid_placeholder attempt bind to invalid placeholder") 00084 { 00085 } 00086 }; 00090 class multiple_rows_query : public cppdb_error { 00091 public: 00092 multiple_rows_query() : cppdb_error( "cppdb::multiple_rows_query " 00093 "multiple rows result for a single row request") 00094 { 00095 } 00096 }; 00097 00101 class not_supported_by_backend : public cppdb_error { 00102 public: 00106 not_supported_by_backend(std::string const &e) : 00107 cppdb_error(e) 00108 { 00109 } 00110 }; 00111 00112 } 00113 00114 #endif