diff options
author | Kim Alvefur <zash@zash.se> | 2017-04-12 20:59:18 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2017-04-12 20:59:18 +0200 |
commit | d418ed105c8eba8fb03375c3e13daf6ef261cfa5 (patch) | |
tree | 812565071e2a3b84ab2fee8ca331e5be4b6e63e7 /util/sql.lua | |
parent | 61c1325aa6509896b202f731c546e980ef97fff4 (diff) | |
parent | 2b914fee7d809f0666ca96db8ee49dd4f64db66c (diff) | |
download | prosody-d418ed105c8eba8fb03375c3e13daf6ef261cfa5.tar.gz prosody-d418ed105c8eba8fb03375c3e13daf6ef261cfa5.zip |
Merge 0.10->trunk
Diffstat (limited to 'util/sql.lua')
-rw-r--r-- | util/sql.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/util/sql.lua b/util/sql.lua index a859ddc9..f7c68ed3 100644 --- a/util/sql.lua +++ b/util/sql.lua @@ -139,6 +139,7 @@ function engine:execute(sql, ...) if not success then return success, err; end local prepared = self.prepared; + sql = self:prepquery(sql); local stmt = prepared[sql]; if not stmt then local err; @@ -159,6 +160,7 @@ 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)); end @@ -254,7 +256,6 @@ function engine:_create_index(index) if index.unique then sql = sql:gsub("^CREATE", "CREATE UNIQUE"); end - sql = self:prepquery(sql); if self._debug then debugquery("create", sql); end @@ -286,7 +287,6 @@ function engine:_create_table(table) if self.params.driver == "MySQL" then sql = sql:gsub(";$", (" CHARACTER SET '%s' COLLATE '%s_bin';"):format(self.charset, self.charset)); end - sql = self:prepquery(sql); if self._debug then debugquery("create", sql); end |