From ea53a31081326c41aa12776cc0f2d4a503bb5e7a Mon Sep 17 00:00:00 2001 From: Vlad <129996061+vvysokikh1@users.noreply.github.com> Date: Fri, 20 Feb 2026 00:36:10 +0900 Subject: [PATCH] refactor: re-order PRAGMA statements (#5140) The page_size will soon be made configurable with #5135, making this re-ordering necessary. When opening SQLite connection, there are specific pragmas set with commonPragmas. In particular, PRAGMA journal_mode creates journal file and locks the page_size; as of this commit, this sets the page size to the default value of 4096. Coincidentally, the hardcoded page_size was also 4096, so no issue was noticed. --- src/xrpld/core/DatabaseCon.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/xrpld/core/DatabaseCon.h b/src/xrpld/core/DatabaseCon.h index 219693b11..f656d83f9 100644 --- a/src/xrpld/core/DatabaseCon.h +++ b/src/xrpld/core/DatabaseCon.h @@ -206,6 +206,12 @@ private: { open(*session_, "sqlite", pPath.string()); + for (auto const& p : pragma) + { + soci::statement st = session_->prepare << p; + st.execute(true); + } + if (commonPragma) { for (auto const& p : *commonPragma) @@ -214,11 +220,7 @@ private: st.execute(true); } } - for (auto const& p : pragma) - { - soci::statement st = session_->prepare << p; - st.execute(true); - } + for (auto const& sql : initSQL) { soci::statement st = session_->prepare << sql;