![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
00001 /* 00002 Copyright 2007 - 2008 MySQL AB, 2008 - 2009 Sun Microsystems, Inc. All rights reserved. 00003 00004 The MySQL Connector/C++ is licensed under the terms of the GPL 00005 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most 00006 MySQL Connectors. There are special exceptions to the terms and 00007 conditions of the GPL as it is applied to this software, see the 00008 FLOSS License Exception 00009 <http://www.mysql.com/about/legal/licensing/foss-exception.html>. 00010 */ 00011 00012 #ifndef _SQL_WARNING_H_ 00013 #define _SQL_WARNING_H_ 00014 00015 00016 #include <stdexcept> 00017 #include <string> 00018 #include <memory> 00019 00020 namespace sql 00021 { 00022 00023 #ifdef _WIN32 00024 #pragma warning (disable : 4290) 00025 //warning C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow) 00026 #endif 00027 00028 class SQLWarning 00029 { 00030 protected: 00031 00032 const std::string sql_state; 00033 const int errNo; 00034 SQLWarning * next; 00035 const std::string descr; 00036 00037 public: 00038 00039 SQLWarning(const std::string& reason, const std::string& SQLState, int vendorCode) :sql_state(SQLState), errNo(vendorCode),descr(reason) 00040 { 00041 } 00042 00043 SQLWarning(const std::string& reason, const std::string& SQLState) :sql_state (SQLState), errNo(0), descr(reason) 00044 { 00045 } 00046 00047 SQLWarning(const std::string& reason) : sql_state ("HY000"), errNo(0), descr(reason) 00048 { 00049 } 00050 00051 SQLWarning() : sql_state ("HY000"), errNo(0) {} 00052 00053 00054 const std::string & getMessage() const 00055 { 00056 return descr; 00057 } 00058 00059 00060 const std::string & getSQLState() const 00061 { 00062 return sql_state; 00063 } 00064 00065 int getErrorCode() const 00066 { 00067 return errNo; 00068 } 00069 00070 const SQLWarning * getNextWarning() const 00071 { 00072 return next; 00073 } 00074 00075 void setNextWarning(SQLWarning * _next) 00076 { 00077 next = _next; 00078 } 00079 00080 virtual ~SQLWarning() throw () {}; 00081 00082 protected: 00083 00084 SQLWarning(const SQLWarning& e) : sql_state(e.sql_state), errNo(e.errNo), next(e.next), descr(e.descr) {} 00085 00086 virtual SQLWarning * copy() 00087 { 00088 return new SQLWarning(*this); 00089 } 00090 00091 private: 00092 const SQLWarning & operator = (const SQLWarning & rhs); 00093 00094 }; 00095 00096 00097 } /* namespace sql */ 00098 00099 #endif /* _SQL_WARNING_H_ */
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.