# HG changeset patch # User Kim Alvefur # Date 1492115911 -7200 # Node ID 7a13fa8904728ea747ca199ddfc31e7ef008dc42 # Parent 32898a74b9d9114393e959a15236b73f49679cc6# Parent 655837e9eeeba7a879b76347530a379ecd4b0990 Merge 0.10->trunk diff -r 32898a74b9d9 -r 7a13fa890472 util/sql.lua --- a/util/sql.lua Thu Apr 13 01:30:24 2017 +0200 +++ b/util/sql.lua Thu Apr 13 22:38:31 2017 +0200 @@ -161,7 +161,14 @@ 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, ...)