view plugins/mod_debug_sql.lua @ 13940:5f8a9e50c2fb 13.0

mod_smacks: Remove extra optional from sm element Since XEP-0198 version 1.6.3, the optional and required children of sm in stream:features have been removed entirely. They already weren’t specified before, and were only leftover from a very old version in the XML Schema. Fixes #1963
author Link Mauve <linkmauve@linkmauve.fr>
date Tue, 02 Sep 2025 00:50:25 +0200
parents 5edb0d01a94f
children
line wrap: on
line source

-- Enables SQL query logging
--
-- luacheck: ignore 213/uri

module:set_global();

local engines = module:shared("/*/sql/connections");

for uri, engine in pairs(engines) do
	engine:debug(true);
end

setmetatable(engines, {
	__newindex = function (t, uri, engine)
		engine:debug(true);
		rawset(t, uri, engine);
	end
});

function module.unload()
	setmetatable(engines, nil);
	for uri, engine in pairs(engines) do
		engine:debug(false);
	end
end