mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-01 09:24:55 +02:00
PostgreSQL SessionHandle: const fixes.
This commit is contained in:
parent
6eec8adfcb
commit
8740816c78
@ -106,7 +106,7 @@ public:
|
|||||||
void startTransaction();
|
void startTransaction();
|
||||||
/// Start transaction
|
/// Start transaction
|
||||||
|
|
||||||
bool isTransaction();
|
bool isTransaction() const;
|
||||||
/// Returns true iff a transaction is a transaction is in progress, false otherwise.
|
/// Returns true iff a transaction is a transaction is in progress, false otherwise.
|
||||||
|
|
||||||
void commit();
|
void commit();
|
||||||
@ -115,13 +115,13 @@ public:
|
|||||||
void rollback();
|
void rollback();
|
||||||
/// Rollback trabsaction
|
/// Rollback trabsaction
|
||||||
|
|
||||||
bool isAutoCommit();
|
bool isAutoCommit() const;
|
||||||
/// is the connection in auto commit mode?
|
/// is the connection in auto commit mode?
|
||||||
|
|
||||||
void setAutoCommit(bool aShouldAutoCommit = true);
|
void setAutoCommit(bool aShouldAutoCommit = true);
|
||||||
/// is the connection in auto commit mode?
|
/// is the connection in auto commit mode?
|
||||||
|
|
||||||
bool isAsynchronousCommit();
|
bool isAsynchronousCommit() const;
|
||||||
/// is the connection in Asynchronous commit mode?
|
/// is the connection in Asynchronous commit mode?
|
||||||
|
|
||||||
void setAsynchronousCommit(bool aShouldAsynchronousCommit = true);
|
void setAsynchronousCommit(bool aShouldAsynchronousCommit = true);
|
||||||
@ -133,10 +133,10 @@ public:
|
|||||||
void setTransactionIsolation(Poco::UInt32 aTI);
|
void setTransactionIsolation(Poco::UInt32 aTI);
|
||||||
/// Sets the transaction isolation level.
|
/// Sets the transaction isolation level.
|
||||||
|
|
||||||
Poco::UInt32 transactionIsolation();
|
Poco::UInt32 transactionIsolation() const;
|
||||||
/// Returns the transaction isolation level.
|
/// Returns the transaction isolation level.
|
||||||
|
|
||||||
bool hasTransactionIsolation(Poco::UInt32 aTI);
|
static bool hasTransactionIsolation(Poco::UInt32 aTI);
|
||||||
/// Returns true iff the transaction isolation level corresponding
|
/// Returns true iff the transaction isolation level corresponding
|
||||||
/// to the supplied bitmask is supported.
|
/// to the supplied bitmask is supported.
|
||||||
|
|
||||||
@ -288,7 +288,7 @@ inline SessionHandle::operator PGconn * ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Poco::FastMutex&SessionHandle::mutex()
|
inline Poco::FastMutex& SessionHandle::mutex()
|
||||||
{
|
{
|
||||||
return _sessionMutex;
|
return _sessionMutex;
|
||||||
}
|
}
|
||||||
@ -300,19 +300,19 @@ inline std::string SessionHandle::connectionString() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool SessionHandle::isTransaction()
|
inline bool SessionHandle::isTransaction() const
|
||||||
{
|
{
|
||||||
return _inTransaction;
|
return _inTransaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool SessionHandle::isAutoCommit()
|
inline bool SessionHandle::isAutoCommit() const
|
||||||
{
|
{
|
||||||
return _isAutoCommit;
|
return _isAutoCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool SessionHandle::isAsynchronousCommit()
|
inline bool SessionHandle::isAsynchronousCommit() const
|
||||||
{
|
{
|
||||||
return _isAsynchronousCommit;
|
return _isAsynchronousCommit;
|
||||||
}
|
}
|
||||||
|
@ -270,6 +270,7 @@ void SessionHandle::rollback()
|
|||||||
|
|
||||||
void SessionHandle::setAutoCommit(bool aShouldAutoCommit)
|
void SessionHandle::setAutoCommit(bool aShouldAutoCommit)
|
||||||
{
|
{
|
||||||
|
// There is no PostgreSQL API call to switch autocommit (unchained) mode off.
|
||||||
if (aShouldAutoCommit == _isAutoCommit)
|
if (aShouldAutoCommit == _isAutoCommit)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -277,8 +278,7 @@ void SessionHandle::setAutoCommit(bool aShouldAutoCommit)
|
|||||||
|
|
||||||
if (aShouldAutoCommit)
|
if (aShouldAutoCommit)
|
||||||
{
|
{
|
||||||
Poco::FastMutex::ScopedLock mutexLocker(_sessionMutex);
|
if (isTransaction())
|
||||||
if (_inTransaction)
|
|
||||||
commit(); // end any in process transaction
|
commit(); // end any in process transaction
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,7 +374,7 @@ void SessionHandle::setTransactionIsolation(Poco::UInt32 aTI)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Poco::UInt32 SessionHandle::transactionIsolation()
|
Poco::UInt32 SessionHandle::transactionIsolation() const
|
||||||
{
|
{
|
||||||
return _tranactionIsolationLevel;
|
return _tranactionIsolationLevel;
|
||||||
}
|
}
|
||||||
|
@ -1991,11 +1991,10 @@ void SQLExecutor::transaction(const std::string& connect)
|
|||||||
|
|
||||||
bool autoCommit = _pSession->getFeature("autoCommit");
|
bool autoCommit = _pSession->getFeature("autoCommit");
|
||||||
|
|
||||||
/* _pSession->setFeature("autoCommit", false);
|
_pSession->setFeature("autoCommit", false);
|
||||||
assertTrue (_pSession->isTransaction());
|
|
||||||
_pSession->setFeature("autoCommit", true);
|
_pSession->setFeature("autoCommit", true);
|
||||||
assertTrue (!_pSession->isTransaction());
|
assertTrue (!_pSession->isTransaction());
|
||||||
*/
|
|
||||||
_pSession->setTransactionIsolation(Session::TRANSACTION_READ_COMMITTED);
|
_pSession->setTransactionIsolation(Session::TRANSACTION_READ_COMMITTED);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user