view plugins/mod_debug_sql.lua @ 14111:1cf6e3f49d10 13.0

net.resolvers: Fix to avoid SRV lookups for IP addresses SRV lookups of the form _service._tcp.192.0.0.8 IN SRV makes no sense. Problem was, what would a service without a default port do? Now this problem belongs to the basic resolver, which gets to return the error.
author Kim Alvefur <zash@zash.se>
date Tue, 24 Mar 2026 16:34:06 +0100
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