diff options
author | Kim Alvefur <zash@zash.se> | 2017-04-13 22:38:31 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2017-04-13 22:38:31 +0200 |
commit | d6af211506ae087d30ee569e97b14ef0ca80fa74 (patch) | |
tree | 706e69e60a8560b8fd6634db84455a21c728c0f9 /util/sql.lua | |
parent | a4b0c946f61d5639fe652d9ddc13bfd0f63d9a17 (diff) | |
parent | 2f0ac824b2ea1ad51c0edf01aaeb9382084f79de (diff) | |
download | prosody-d6af211506ae087d30ee569e97b14ef0ca80fa74.tar.gz prosody-d6af211506ae087d30ee569e97b14ef0ca80fa74.zip |
Merge 0.10->trunk
Diffstat (limited to 'util/sql.lua')
-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, ...) |