mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 11:06:50 +01:00
added new memeber SqlState to PostgreSQLException and made use of it. (#4099)
* added new memeber SqlState to PostgreSQLException and made use of it in StatementExecutor * Added test case testSqlState * fixed nameing convention errors. fixed bug in PostgreSQLException::PostgreSQLException regarding null termination of _sqlState data member
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
|
||||
|
||||
#include "Poco/Data/PostgreSQL/PostgreSQLException.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
@@ -25,6 +25,19 @@ PostgreSQLException::PostgreSQLException(const std::string& aMessage):
|
||||
{
|
||||
}
|
||||
|
||||
PostgreSQLException::PostgreSQLException(const std::string& aMessage,const char* pAnSqlState):
|
||||
Poco::Data::DataException(std::string("[PostgreSQL]: ") + aMessage)
|
||||
{
|
||||
// handle anSqlState
|
||||
if (pAnSqlState == nullptr) _sqlState[0] = '\0';
|
||||
else
|
||||
{
|
||||
strncpy(_sqlState,pAnSqlState,5);
|
||||
_sqlState[5] = '\0';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
PostgreSQLException::PostgreSQLException(const PostgreSQLException& anException):
|
||||
Poco::Data::DataException(anException)
|
||||
@@ -68,5 +81,12 @@ StatementException::StatementException(const std::string& aMessage):
|
||||
{
|
||||
}
|
||||
|
||||
StatementException::StatementException(const std::string& aMessage,const char* pAnSqlState):
|
||||
PostgreSQLException(aMessage,pAnSqlState)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::PostgreSQL
|
||||
|
||||
Reference in New Issue
Block a user