mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-12 22:36:54 +02:00
added Session::isTransaction()
This commit is contained in:
@@ -83,6 +83,9 @@ public:
|
||||
bool isConnected();
|
||||
/// Returns true if connected, false otherwise.
|
||||
|
||||
bool isTransaction();
|
||||
/// Returns true iff a transaction is in progress.
|
||||
|
||||
private:
|
||||
void open();
|
||||
/// Opens a connection to the Database.
|
||||
@@ -90,6 +93,7 @@ private:
|
||||
std::string _dbFileName;
|
||||
sqlite3* _pDB;
|
||||
bool _connected;
|
||||
bool _isTransaction;
|
||||
|
||||
static const std::string DEFERRED_BEGIN_TRANSACTION;
|
||||
static const std::string COMMIT_TRANSACTION;
|
||||
@@ -97,6 +101,15 @@ private:
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline bool SessionImpl::isTransaction()
|
||||
{
|
||||
return _isTransaction;
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::SQLite
|
||||
|
||||
|
||||
|
@@ -54,7 +54,8 @@ const std::string SessionImpl::ABORT_TRANSACTION("ROLLBACK");
|
||||
SessionImpl::SessionImpl(const std::string& fileName):
|
||||
_dbFileName(fileName),
|
||||
_pDB(0),
|
||||
_connected(false)
|
||||
_connected(false),
|
||||
_isTransaction(false)
|
||||
{
|
||||
open();
|
||||
}
|
||||
@@ -78,6 +79,7 @@ void SessionImpl::begin()
|
||||
SQLiteStatementImpl tmp(*this, _pDB);
|
||||
tmp.add(DEFERRED_BEGIN_TRANSACTION);
|
||||
tmp.execute();
|
||||
_isTransaction = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +88,7 @@ void SessionImpl::commit()
|
||||
SQLiteStatementImpl tmp(*this, _pDB);
|
||||
tmp.add(COMMIT_TRANSACTION);
|
||||
tmp.execute();
|
||||
_isTransaction = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +97,7 @@ void SessionImpl::rollback()
|
||||
SQLiteStatementImpl tmp(*this, _pDB);
|
||||
tmp.add(ABORT_TRANSACTION);
|
||||
tmp.execute();
|
||||
_isTransaction = false;
|
||||
}
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user