00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef MYSQL_EXCEPTIONS_H
00022 #define MYSQL_EXCEPTIONS_H
00023
00024 using namespace std;
00025
00026 #include <string>
00027 #include <iostream>
00028
00033 class MySQL_TwoStringException {
00034 protected:
00035 string f_name;
00036 string message;
00037 public:
00038 MySQL_TwoStringException(const string & f_n, const string m) : f_name(f_n), message(m) {}
00039 virtual void printError(const bool & fatal = false) const = 0;
00040 virtual ~MySQL_TwoStringException() {}
00041 };
00042
00043 class MySQL_StringNumException {
00044 protected:
00045 string f_name;
00046 unsigned message;
00047 public:
00048 MySQL_StringNumException(const string & f_n, const unsigned m) : f_name(f_n), message(m) {}
00049 virtual void printError(const bool & fatal = false) const = 0;
00050 virtual ~MySQL_StringNumException() {}
00051 };
00052
00053 class MySQL_ConnectFailed : public MySQL_TwoStringException {
00054 public:
00055 MySQL_ConnectFailed(const string & f_n, const string m) : MySQL_TwoStringException(f_n, m) {}
00056 void printError(const bool & fatal) const;
00057 };
00058
00059 class MySQL_QueryFailed : public MySQL_TwoStringException {
00060 public:
00061 MySQL_QueryFailed(const string & f_n, const string m) : MySQL_TwoStringException(f_n, m) {}
00062 void printError(const bool & fatal) const;
00063 };
00064
00065 class MySQL_IndexOutOfRange : public MySQL_StringNumException {
00066 public:
00067 MySQL_IndexOutOfRange(const string & f_n, const unsigned m) : MySQL_StringNumException(f_n, m) {}
00068 void printError(const bool & fatal) const;
00069 };
00070
00071 #endif