# HG changeset patch # User Kim Alvefur # Date 1510134358 -3600 # Node ID a597ff326758d8d68b31784992e2f034e29abd4d # Parent 2a0915aa61314ee92b5107e9478243228094a31e util.sql: Discard useless substitution count from string.gsub in SQL debug logs diff -r 2a0915aa6131 -r a597ff326758 util/sql.lua --- a/util/sql.lua Tue Nov 07 09:29:04 2017 +0100 +++ b/util/sql.lua Wed Nov 08 10:45:58 2017 +0100 @@ -161,14 +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 () + 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))); end function engine:execute_query(sql, ...)