Small PostgreSQL improvements (#1932)

* Supporting non-standard port in testConnectNoDB, suppressing NOTICE messages about non-existing tables for a cleaner output

* fix style
This commit is contained in:
Stefan Csomor 2017-10-11 01:53:46 +02:00 committed by Aleksandar Fabijanic
parent 726bcc9202
commit 03e07f3d97

View File

@ -122,6 +122,7 @@ void PostgreSQLTest::testConnectNoDB()
dbConnString += "host=" + getHost(); dbConnString += "host=" + getHost();
dbConnString += " user=" + getUser(); dbConnString += " user=" + getUser();
dbConnString += " password=" + getPass(); dbConnString += " password=" + getPass();
dbConnString += " port=" + getPort();
try try
{ {
@ -889,7 +890,12 @@ void PostgreSQLTest::testTupleWithNullable()
void PostgreSQLTest::dropTable(const std::string& tableName) void PostgreSQLTest::dropTable(const std::string& tableName)
{ {
try { *_pSession << format("DROP TABLE IF EXISTS %s", tableName), now; } try
{
*_pSession << "SET client_min_messages=warning", now;
*_pSession << format("DROP TABLE IF EXISTS %s", tableName), now;
*_pSession << "RESET client_min_messages", now;
}
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail ("dropTable()"); } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail ("dropTable()"); }
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail ("dropTable()"); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail ("dropTable()"); }
} }