Software /
code /
prosody
Comparison
plugins/mod_debug_sql.lua @ 7176:b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 21 Feb 2016 19:29:31 +0100 |
child | 8391:5edb0d01a94f |
comparison
equal
deleted
inserted
replaced
7175:3e7c69190193 | 7176:b8bbd5f91ad9 |
---|---|
1 -- Enables SQL query logging | |
2 -- | |
3 -- luacheck: ignore 213/uri | |
4 | |
5 local engines = module:shared("/*/sql/connections"); | |
6 | |
7 for uri, engine in pairs(engines) do | |
8 engine:debug(true); | |
9 end | |
10 | |
11 setmetatable(engines, { | |
12 __newindex = function (t, uri, engine) | |
13 engine:debug(true); | |
14 rawset(t, uri, engine); | |
15 end | |
16 }); | |
17 | |
18 function module.unload() | |
19 setmetatable(engines, nil); | |
20 for uri, engine in pairs(engines) do | |
21 engine:debug(false); | |
22 end | |
23 end | |
24 | |
25 |