Skip to content

Commit 0ece395

Browse files
authored
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.
1 parent b6391fe commit 0ece395

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/xrpld/core/DatabaseCon.h

+7-5
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,12 @@ class DatabaseCon
206206
{
207207
open(*session_, "sqlite", pPath.string());
208208

209+
for (auto const& p : pragma)
210+
{
211+
soci::statement st = session_->prepare << p;
212+
st.execute(true);
213+
}
214+
209215
if (commonPragma)
210216
{
211217
for (auto const& p : *commonPragma)
@@ -214,11 +220,7 @@ class DatabaseCon
214220
st.execute(true);
215221
}
216222
}
217-
for (auto const& p : pragma)
218-
{
219-
soci::statement st = session_->prepare << p;
220-
st.execute(true);
221-
}
223+
222224
for (auto const& sql : initSQL)
223225
{
224226
soci::statement st = session_->prepare << sql;

0 commit comments

Comments
 (0)