Commit 950fc162 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

sqlite: Allow read operations as part of a transaction

parent 1aa56304
......@@ -174,8 +174,9 @@ class Tools
template <typename IMPL, typename INTF, typename... Args>
static std::vector<std::shared_ptr<INTF> > fetchAll( DBConnection dbConnection, const std::string& req, Args&&... args )
{
assert(Transaction::transactionInProgress() == false);
auto ctx = dbConnection->acquireContext();
SqliteConnection::RequestContext ctx;
if (Transaction::transactionInProgress() == false)
ctx = dbConnection->acquireContext();
auto chrono = std::chrono::steady_clock::now();
std::vector<std::shared_ptr<INTF>> results;
......@@ -196,8 +197,9 @@ class Tools
template <typename T, typename... Args>
static std::shared_ptr<T> fetchOne( DBConnection dbConnection, const std::string& req, Args&&... args )
{
assert(Transaction::transactionInProgress() == false);
auto ctx = dbConnection->acquireContext();
SqliteConnection::RequestContext ctx;
if (Transaction::transactionInProgress() == false)
ctx = dbConnection->acquireContext();
auto chrono = std::chrono::steady_clock::now();
auto stmt = Statement( dbConnection, req );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment