[FarGroup/FarManager] master: Add sqlite3.dll version check (8f955510b)

0 views
Skip to first unread message

farg...@farmanager.com

unread,
Mar 25, 2026, 4:15:57 PM (2 days ago) Mar 25
to farco...@googlegroups.com
Repository : https://github.com/FarGroup/FarManager
On branch : master
Link : https://github.com/FarGroup/FarManager/commit/8f955510bd06835767e36ae2f27ac03eb410f5f2

>---------------------------------------------------------------

commit 8f955510bd06835767e36ae2f27ac03eb410f5f2
Author: Alex Alabuzhev <alab...@gmail.com>
Date: Wed Mar 25 20:10:53 2026 +0000

Add sqlite3.dll version check


>---------------------------------------------------------------

8f955510bd06835767e36ae2f27ac03eb410f5f2
far/changelog | 5 +++++
far/sqlitedb.cpp | 29 ++++++++++++++++++++++++++---
far/vbuild.m4 | 2 +-
3 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/far/changelog b/far/changelog
index e7a7f1005..9ec582eed 100644
--- a/far/changelog
+++ b/far/changelog
@@ -1,3 +1,8 @@
+--------------------------------------------------------------------------------
+drkns 2026-03-25 20:07:10+00:00 - build 6667
+
+1. Add sqlite3.dll version check.
+
--------------------------------------------------------------------------------
drkns 2026-03-23 23:23:23+00:00 - build 6666

diff --git a/far/sqlitedb.cpp b/far/sqlitedb.cpp
index 3a6912d60..5953def8c 100644
--- a/far/sqlitedb.cpp
+++ b/far/sqlitedb.cpp
@@ -201,8 +201,31 @@ bool far_sqlite_exception::is_constraint_unique() const
return m_ErrorCode == SQLITE_CONSTRAINT_UNIQUE;
}

+static void check_version()
+{
+ const auto
+ MinMajor = 3,
+ MinMinor = 52,
+ MinPatch = 0;
+
+ const auto MinVersion = MinMajor * 1000000 + MinMinor * 1000 + MinPatch;
+
+ static_assert(SQLITE_VERSION_NUMBER >= MinVersion);
+
+ if (sqlite::sqlite3_libversion_number() < MinVersion)
+ {
+ throw far_known_exception(far::format(
+ L"SQLite library version {} is too old, at least {}.{}.{} is required"sv,
+ encoding::utf8::get_chars(sqlite::sqlite3_libversion()),
+ MinMajor, MinMinor, MinPatch
+ ));
+ }
+}
+
void SQLiteDb::library_load()
{
+ check_version();
+
sqlite::sqlite3_config(SQLITE_CONFIG_LOG, sqlite_log, nullptr);

if (const auto Result = sqlite::sqlite3_initialize(); Result != SQLITE_OK)
@@ -430,7 +453,7 @@ public:
{
database_ptr Db;

- int Retires = 0;
+ int Attempts = 0;

for (;;)
{
@@ -438,7 +461,7 @@ public:
if (Result == SQLITE_OK)
break;

- if (Result == SQLITE_BUSY && BusyHandler.first && BusyHandler.first(BusyHandler.second, Retires++))
+ if (Result == SQLITE_BUSY && BusyHandler.first && BusyHandler.first(BusyHandler.second, Attempts++))
continue;

if (Db)
@@ -569,7 +592,7 @@ SQLiteDb::SQLiteStmt SQLiteDb::create_stmt(std::string_view const Stmt, bool Per
// that is the number of bytes in the input string *including* the nul-terminator.

// We use data() instead of operator[] here to bypass any bounds checks in debug mode
- const auto IsNullTerminated = Stmt.data()[Stmt.size()] == L'\0';
+ const auto IsNullTerminated = Stmt.data()[Stmt.size()] == '\0';

invoke(m_Db.get(), [&]
{
diff --git a/far/vbuild.m4 b/far/vbuild.m4
index 0d195f490..cbac7749d 100644
--- a/far/vbuild.m4
+++ b/far/vbuild.m4
@@ -1 +1 @@
-6666
+6667


Reply all
Reply to author
Forward
0 new messages