code cleanup

This commit is contained in:
Günter Obiltschnig
2020-01-25 20:43:13 +01:00
parent 65be8b0bb6
commit 14e58b7fea
20 changed files with 209 additions and 304 deletions

View File

@@ -33,7 +33,8 @@ const std::string SessionHandle::POSTGRESQL_REPEATABLE_READ = "REPEATABLE READ";
const std::string SessionHandle::POSTGRESQL_SERIALIZABLE = "SERIALIZABLE";
SessionHandle::SessionHandle(): _pConnection(0),
SessionHandle::SessionHandle():
_pConnection(0),
_inTransaction(false),
_isAutoCommit(true),
_isAsynchronousCommit(false),
@@ -41,6 +42,7 @@ SessionHandle::SessionHandle(): _pConnection(0),
{
}
SessionHandle::~SessionHandle()
{
try
@@ -65,12 +67,10 @@ bool SessionHandle::isConnectedNoLock() const
{
// DO NOT ACQUIRE THE MUTEX IN PRIVATE METHODS
if (_pConnection
&& PQstatus(_pConnection) == CONNECTION_OK)
if (_pConnection && PQstatus(_pConnection) == CONNECTION_OK)
{
return true;
}
return false;
}
@@ -86,7 +86,6 @@ void SessionHandle::connect(const std::string& aConnectionString)
_pConnection = PQconnectdb(aConnectionString.c_str());
if (! isConnectedNoLock())
{
throw ConnectionFailedException(std::string("Connection Error: ") + lastErrorNoLock());
@@ -376,8 +375,7 @@ void SessionHandle::setTransactionIsolation(Poco::UInt32 aTI)
}
Poco::UInt32
SessionHandle::transactionIsolation()
Poco::UInt32 SessionHandle::transactionIsolation()
{
return _tranactionIsolationLevel;
}
@@ -420,9 +418,9 @@ void SessionHandle::deallocatePreparedStatement(const std::string& aPreparedStat
void SessionHandle::deallocatePreparedStatementNoLock(const std::string& aPreparedStatementToDeAllocate)
{
PGresult* pPQResult = PQexec(_pConnection, (std::string("DEALLOCATE ") + aPreparedStatementToDeAllocate).c_str());
PQResultClear resultClearer(pPQResult);
if (PQresultStatus(pPQResult) != PGRES_COMMAND_OK)
{
throw StatementException(std::string("DEALLOCATE statement failed: ") + lastErrorNoLock());
@@ -562,4 +560,4 @@ SessionParametersMap SessionHandle::connectionParameters() const
}
}}} // Poco::Data::PostgreSQL
} } } // Poco::Data::PostgreSQL