aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-06-10 14:01:56 +0200
committerKim Alvefur <zash@zash.se>2023-06-10 14:01:56 +0200
commit0b74dcbdfbb598e58aad43d48316b97e5a0a5675 (patch)
tree7fb64ff72d4ac03472c03b9b4d9265828793f870
parentdd37d17425c58e539c7aa19d30edf194b2c8f071 (diff)
downloadprosody-0b74dcbdfbb598e58aad43d48316b97e5a0a5675.tar.gz
prosody-0b74dcbdfbb598e58aad43d48316b97e5a0a5675.zip
mod_storage_sql: Record all SQLite3 compile options for potential use
Knowing what features are available could be useful for future experiments. For example, with the JSON module or full text search.
-rw-r--r--plugins/mod_storage_sql.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/mod_storage_sql.lua b/plugins/mod_storage_sql.lua
index 4b38e9fe..3caf4572 100644
--- a/plugins/mod_storage_sql.lua
+++ b/plugins/mod_storage_sql.lua
@@ -623,7 +623,7 @@ function archive_store:delete(username, query)
LIMIT %s OFFSET ?
);]];
if engine.params.driver == "SQLite3" then
- if engine._have_delete_limit then
+ if engine.sqlite_compile_options.enable_update_delete_limit then
sql_query = [[
DELETE FROM "prosodyarchive"
WHERE %s
@@ -903,11 +903,13 @@ function module.load()
end
end
if engine.params.driver == "SQLite3" then
+ local compile_options = {}
for row in engine:select("PRAGMA compile_options") do
- if row[1] == "ENABLE_UPDATE_DELETE_LIMIT" then
- engine._have_delete_limit = true;
- end
+ local option = row[1]:lower();
+ local opt, val = option:match("^([^=]+)=(.*)$");
+ compile_options[opt or option] = tonumber(val) or val or true;
end
+ engine.sqlite_compile_options = compile_options;
end
module:set_status("info", "Connected to " .. engine.params.driver);
end, function (engine) -- luacheck: ignore 431/engine