diff options
author | Kim Alvefur <zash@zash.se> | 2016-02-22 15:24:20 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2016-02-22 15:24:20 +0100 |
commit | cccb4ab09be9573c02e0d2684e062363cd7eb068 (patch) | |
tree | 3bb6d5bb05f75122414728e4605bbdb9aacacae0 /plugins/mod_debug_sql.lua | |
parent | e13dc52b494737b8fa8e9c14ce68810782bee7aa (diff) | |
parent | 7ebc652e1dde5db4ba00782579a1948b912fa930 (diff) | |
download | prosody-cccb4ab09be9573c02e0d2684e062363cd7eb068.tar.gz prosody-cccb4ab09be9573c02e0d2684e062363cd7eb068.zip |
Merge 0.10->trunk
Diffstat (limited to 'plugins/mod_debug_sql.lua')
-rw-r--r-- | plugins/mod_debug_sql.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/plugins/mod_debug_sql.lua b/plugins/mod_debug_sql.lua new file mode 100644 index 00000000..7bbbbd88 --- /dev/null +++ b/plugins/mod_debug_sql.lua @@ -0,0 +1,25 @@ +-- Enables SQL query logging +-- +-- luacheck: ignore 213/uri + +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 + + |