Skip to content

Commit

Permalink
refactor: re-order PRAGMA statements (XRPLF#5140)
Browse files Browse the repository at this point in the history
The page_size will soon be made configurable with XRPLF#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.
  • Loading branch information
vvysokikh1 authored Sep 20, 2024
1 parent b6391fe commit 0ece395
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/xrpld/core/DatabaseCon.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ class DatabaseCon
{
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)
Expand All @@ -214,11 +220,7 @@ class DatabaseCon
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;
Expand Down

0 comments on commit 0ece395

Please sign in to comment.