forked from qt-creator/qt-creator
Sqlite: Add busy handler
A busy handler is much more flexible than a timeout. In most cases we can remove the busy exception handling code. Change-Id: I59666ccfbd380a341412e3d25e6716b07097bf3c Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -55,13 +55,13 @@ public:
|
||||
using MutexType = std::mutex;
|
||||
using ReadStatement = Sqlite::ReadStatement;
|
||||
using WriteStatement = Sqlite::WriteStatement;
|
||||
using BusyHandler = DatabaseBackend::BusyHandler;
|
||||
|
||||
Database();
|
||||
Database(Utils::PathString &&databaseFilePath, JournalMode journalMode = JournalMode::Wal);
|
||||
Database(Utils::PathString &&databaseFilePath,
|
||||
JournalMode journalMode);
|
||||
Database(Utils::PathString &&databaseFilePath,
|
||||
std::chrono::milliseconds busyTimeout = 1000ms,
|
||||
JournalMode journalMode=JournalMode::Wal);
|
||||
std::chrono::milliseconds busyTimeout,
|
||||
JournalMode journalMode = JournalMode::Wal);
|
||||
~Database();
|
||||
|
||||
Database(const Database &) = delete;
|
||||
@@ -132,6 +132,11 @@ public:
|
||||
void setAttachedTables(const Utils::SmallStringVector &tables) override;
|
||||
void applyAndUpdateSessions() override;
|
||||
|
||||
void setBusyHandler(BusyHandler busyHandler)
|
||||
{
|
||||
m_databaseBackend.setBusyHandler(std::move(busyHandler));
|
||||
}
|
||||
|
||||
SessionChangeSets changeSets() const;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user