mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-24 17:30:44 +02: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:
@@ -765,6 +765,20 @@ void PostgreSQLTest::testReconnect()
|
||||
}
|
||||
|
||||
|
||||
void PostgreSQLTest::testSqlState()
|
||||
{
|
||||
if (!_pSession) fail ("Test not available.");
|
||||
|
||||
try
|
||||
{
|
||||
*_pSession << "syntax error", now;
|
||||
}
|
||||
catch (const Poco::Data::PostgreSQL::PostgreSQLException & exception)
|
||||
{
|
||||
assertTrue(exception.sqlState() == std::string("42601"));
|
||||
}
|
||||
}
|
||||
|
||||
void PostgreSQLTest::testNullableInt()
|
||||
{
|
||||
if (!_pSession) fail ("Test not available.");
|
||||
@@ -1271,6 +1285,7 @@ CppUnit::Test* PostgreSQLTest::suite()
|
||||
CppUnit_addTest(pSuite, PostgreSQLTest, testNullableInt);
|
||||
CppUnit_addTest(pSuite, PostgreSQLTest, testNullableString);
|
||||
CppUnit_addTest(pSuite, PostgreSQLTest, testTupleWithNullable);
|
||||
CppUnit_addTest(pSuite, PostgreSQLTest, testSqlState);
|
||||
|
||||
CppUnit_addTest(pSuite, PostgreSQLTest, testBinarySimpleAccess);
|
||||
CppUnit_addTest(pSuite, PostgreSQLTest, testBinaryComplexType);
|
||||
|
||||
@@ -27,8 +27,8 @@ class PostgreSQLTest: public CppUnit::TestCase
|
||||
///
|
||||
/// Driver | DB | OS
|
||||
/// ----------------+---------------------------+------------------------------------------
|
||||
/// 03.51.12.00 | PostgreSQL 9.3.1.0(18) | Mac OSX 10.9.1
|
||||
///
|
||||
/// 03.51.12.00 | PostgreSQL 9.3.1.0(18) | Mac OSX 10.9.1
|
||||
/// | PostgreSQL 15.3 | Ubuntu 16.04
|
||||
|
||||
{
|
||||
public:
|
||||
@@ -113,6 +113,8 @@ public:
|
||||
|
||||
void testReconnect();
|
||||
|
||||
void testSqlState();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user