Diff

plugins/mod_storage_sql.lua @ 13148:c6f46f33cecf

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.
author Kim Alvefur <zash@zash.se>
date Sat, 10 Jun 2023 14:01:56 +0200
parent 13144:033ea8b46d6a
child 13149:0aaf67f70015
line wrap: on
line diff
--- a/plugins/mod_storage_sql.lua	Sat Jun 10 22:20:26 2023 +0200
+++ b/plugins/mod_storage_sql.lua	Sat Jun 10 14:01:56 2023 +0200
@@ -623,7 +623,7 @@
 				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 @@
 				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