Poco::Data::MySQL::ConnectionException doesn't set mysql_ernno() to base Exception class #273

This commit is contained in:
Alex Fabijanic 2017-10-12 15:27:44 -05:00
parent d578109d4d
commit d816f54e3c
2 changed files with 9 additions and 5 deletions

View File

@ -39,7 +39,7 @@ class MySQL_API MySQLException: public Poco::Data::DataException
{ {
public: public:
MySQLException(const std::string& msg); MySQLException(const std::string& msg, int errCode = 0);
/// Creates MySQLException. /// Creates MySQLException.
MySQLException(const MySQLException& exc); MySQLException(const MySQLException& exc);

View File

@ -21,12 +21,14 @@ namespace Data {
namespace MySQL { namespace MySQL {
MySQLException::MySQLException(const std::string& msg) : Poco::Data::DataException(std::string("[MySQL]: ") + msg) MySQLException::MySQLException(const std::string& msg, int errCode) :
Poco::Data::DataException(std::string("[MySQL]: ") + msg, errCode)
{ {
} }
MySQLException::MySQLException(const MySQLException& exc) : Poco::Data::DataException(exc) MySQLException::MySQLException(const MySQLException& exc) :
Poco::Data::DataException(exc)
{ {
} }
@ -48,7 +50,8 @@ ConnectionException::ConnectionException(const std::string& msg) : MySQLExceptio
} }
ConnectionException::ConnectionException(const std::string& text, MYSQL* h) : MySQLException(compose(text, h)) ConnectionException::ConnectionException(const std::string& text, MYSQL* h) :
MySQLException(compose(text, h), mysql_errno(h))
{ {
} }
@ -101,7 +104,8 @@ StatementException::StatementException(const std::string& msg) : MySQLException(
} }
StatementException::StatementException(const std::string& text, MYSQL_STMT* h, const std::string& stmt) : MySQLException(compose(text, h, stmt)) StatementException::StatementException(const std::string& text, MYSQL_STMT* h, const std::string& stmt) :
MySQLException(compose(text, h, stmt), mysql_stmt_errno(h))
{ {
} }