File

plugins/mod_debug_sql.lua @ 12878:0d8bf401fa73 0.12

core.sessionmanager: Mark session as destroyed to prevent reentry If it reaches this point, then the session will be most definitely be destroyed, so try to prevent destroy_session() from being called again.
author Kim Alvefur <zash@zash.se>
date Thu, 19 Jan 2023 21:40:09 +0100
parent 8391:5edb0d01a94f
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