diff options
author | Kim Alvefur <zash@zash.se> | 2017-04-13 22:37:35 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2017-04-13 22:37:35 +0200 |
commit | 2f0ac824b2ea1ad51c0edf01aaeb9382084f79de (patch) | |
tree | 434831542f3b56b1e49f2ad4f2155de72250a991 /util | |
parent | 6670a5b17909e755e132a1d211d8e4a1524dac19 (diff) | |
download | prosody-2f0ac824b2ea1ad51c0edf01aaeb9382084f79de.tar.gz prosody-2f0ac824b2ea1ad51c0edf01aaeb9382084f79de.zip |
util.sql: Produce more SQL-standard-like debug messages
Diffstat (limited to 'util')
-rw-r--r-- | util/sql.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/util/sql.lua b/util/sql.lua index f7c68ed3..15749911 100644 --- a/util/sql.lua +++ b/util/sql.lua @@ -161,7 +161,14 @@ local result_mt = { __index = { local function debugquery(where, sql, ...) local i = 0; local a = {...} sql = sql:gsub("\n?\t+", " "); - log("debug", "[%s] %s", where, sql:gsub("%?", function () i = i + 1; local v = a[i]; if type(v) == "string" then v = ("%q"):format(v); end return tostring(v); end)); + log("debug", "[%s] %s", where, sql:gsub("%?", function () + i = i + 1; + local v = a[i]; + if type(v) == "string" then + v = ("'%s'"):format(v:gsub("'", "''")); + end + return tostring(v); + end)); end function engine:execute_query(sql, ...) |