41
41
namespace sql
42
42
{
43
43
44
- #if (__cplusplus < 201103L)
45
- #define MEMORY_ALLOC_OPERATORS (Class ) \
46
- void * operator new (size_t size) throw (std::bad_alloc) { return ::operator new (size); } \
47
- void * operator new (size_t , void *) throw (); \
48
- void * operator new (size_t , const std::nothrow_t &) throw (); \
49
- void * operator new [](size_t ) throw (std::bad_alloc); \
50
- void * operator new [](size_t , void *) throw (); \
51
- void * operator new [](size_t , const std::nothrow_t &) throw (); \
52
- void * operator new (size_t N, std::allocator<Class>&);
53
- #else
54
44
#define MEMORY_ALLOC_OPERATORS (Class ) \
55
45
void * operator new (size_t size){ return ::operator new (size); } \
56
46
void * operator new (size_t , void *) noexcept ; \
@@ -60,20 +50,9 @@ namespace sql
60
50
void * operator new [](size_t , const std::nothrow_t &) noexcept ; \
61
51
void * operator new (size_t N, std::allocator<Class>&);
62
52
63
- #endif
64
- #ifdef _WIN32
65
- #pragma warning (disable : 4290)
66
- // warning C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
67
-
68
53
69
- #pragma warning(push)
70
- #pragma warning(disable: 4275)
71
- #endif
72
- class CPPCONN_PUBLIC_FUNC SQLException : public std::runtime_error
54
+ class SQLException : public std ::runtime_error
73
55
{
74
- #ifdef _WIN32
75
- #pragma warning(pop)
76
- #endif
77
56
protected:
78
57
const std::string sql_state;
79
58
const int errNo;
@@ -109,38 +88,38 @@ class CPPCONN_PUBLIC_FUNC SQLException : public std::runtime_error
109
88
return errNo;
110
89
}
111
90
112
- virtual ~SQLException () throw () {};
91
+ virtual ~SQLException () noexcept {};
113
92
114
93
protected:
115
94
MEMORY_ALLOC_OPERATORS (SQLException)
116
95
};
117
96
118
- struct CPPCONN_PUBLIC_FUNC MethodNotImplementedException : public SQLException
97
+ struct MethodNotImplementedException : public SQLException
119
98
{
120
99
MethodNotImplementedException (const MethodNotImplementedException& e) : SQLException(e.what(), e.sql_state, e.errNo) { }
121
100
MethodNotImplementedException (const std::string& reason) : SQLException(reason, " " , 0 ) {}
122
101
};
123
102
124
- struct CPPCONN_PUBLIC_FUNC InvalidArgumentException : public SQLException
103
+ struct InvalidArgumentException : public SQLException
125
104
{
126
105
InvalidArgumentException (const InvalidArgumentException& e) : SQLException(e.what(), e.sql_state, e.errNo) { }
127
106
InvalidArgumentException (const std::string& reason) : SQLException(reason, " " , 0 ) {}
128
107
};
129
108
130
- struct CPPCONN_PUBLIC_FUNC InvalidInstanceException : public SQLException
109
+ struct InvalidInstanceException : public SQLException
131
110
{
132
111
InvalidInstanceException (const InvalidInstanceException& e) : SQLException(e.what(), e.sql_state, e.errNo) { }
133
112
InvalidInstanceException (const std::string& reason) : SQLException(reason, " " , 0 ) {}
134
113
};
135
114
136
115
137
- struct CPPCONN_PUBLIC_FUNC NonScrollableException : public SQLException
116
+ struct NonScrollableException : public SQLException
138
117
{
139
118
NonScrollableException (const NonScrollableException& e) : SQLException(e.what(), e.sql_state, e.errNo) { }
140
119
NonScrollableException (const std::string& reason) : SQLException(reason, " " , 0 ) {}
141
120
};
142
121
143
- struct CPPCONN_PUBLIC_FUNC SQLUnsupportedOptionException : public SQLException
122
+ struct SQLUnsupportedOptionException : public SQLException
144
123
{
145
124
SQLUnsupportedOptionException (const SQLUnsupportedOptionException& e, const std::string conn_option) :
146
125
SQLException (e.what(), e.sql_state, e.errNo),
@@ -157,7 +136,7 @@ struct CPPCONN_PUBLIC_FUNC SQLUnsupportedOptionException : public SQLException
157
136
return option.c_str ();
158
137
}
159
138
160
- ~SQLUnsupportedOptionException () throw () {};
139
+ ~SQLUnsupportedOptionException () noexcept {};
161
140
protected:
162
141
const std::string option;
163
142
};
0 commit comments