From 36d0c8d1d781d80e4bee71208d72ea5a1f8e1fec Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 31 Jan 2021 22:35:54 +0300 Subject: we import slower, but more securely (flush database time to time) --- plugins/Dbx_sqlite/src/dbintf.cpp | 14 ++++++++++++++ plugins/Dbx_sqlite/src/dbintf.h | 1 + 2 files changed, 15 insertions(+) (limited to 'plugins/Dbx_sqlite/src') diff --git a/plugins/Dbx_sqlite/src/dbintf.cpp b/plugins/Dbx_sqlite/src/dbintf.cpp index 474aaad4a5..9e6cbeb6bb 100755 --- a/plugins/Dbx_sqlite/src/dbintf.cpp +++ b/plugins/Dbx_sqlite/src/dbintf.cpp @@ -25,6 +25,8 @@ CDbxSQLite::~CDbxSQLite() } } +///////////////////////////////////////////////////////////////////////////////////////// + int CDbxSQLite::Create(const wchar_t *profile) { sqlite3 *database = nullptr; @@ -64,6 +66,8 @@ int CDbxSQLite::Create(const wchar_t *profile) return 0; } +///////////////////////////////////////////////////////////////////////////////////////// + int CDbxSQLite::Check(const wchar_t *profile) { FILE *hFile = _wfopen(profile, L"rb"); @@ -96,6 +100,8 @@ int CDbxSQLite::Check(const wchar_t *profile) return EGROKPRF_NOERROR; } +///////////////////////////////////////////////////////////////////////////////////////// + MDatabaseCommon* CDbxSQLite::Load(const wchar_t *profile, int readonly) { sqlite3 *database = nullptr; @@ -138,6 +144,8 @@ MDatabaseCommon* CDbxSQLite::Load(const wchar_t *profile, int readonly) return db; } +///////////////////////////////////////////////////////////////////////////////////////// + BOOL CDbxSQLite::Backup(LPCWSTR profile) { sqlite3 *database = nullptr; @@ -182,6 +190,12 @@ void CDbxSQLite::DBFlush(bool bForce) m_impl.m_timer.Start(50); } +BOOL CDbxSQLite::Flush() +{ + DBFlush(true); + return ERROR_SUCCESS; +} + BOOL CDbxSQLite::IsRelational() { return TRUE; diff --git a/plugins/Dbx_sqlite/src/dbintf.h b/plugins/Dbx_sqlite/src/dbintf.h index 98b8765195..9acbe25db9 100755 --- a/plugins/Dbx_sqlite/src/dbintf.h +++ b/plugins/Dbx_sqlite/src/dbintf.h @@ -129,6 +129,7 @@ public: STDMETHODIMP_(BOOL) Compact() override; STDMETHODIMP_(BOOL) Backup(LPCWSTR) override; + STDMETHODIMP_(BOOL) Flush() override; STDMETHODIMP_(DATABASELINK*) GetDriver() override; -- cgit v1.2.3