aboutsummaryrefslogtreecommitdiffstats
path: root/util/sql.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2015-07-08 15:14:24 +0100
committerMatthew Wild <mwild1@gmail.com>2015-07-08 15:14:24 +0100
commiteed81c2f941254646a0e77e6ca3f9a7b95710772 (patch)
treea4dc5c0d0f25460ca4f90b7e19a82ee93cfa45db /util/sql.lua
parent9f5bd334c59da59813016d3f98cb31a5c144fcda (diff)
downloadprosody-eed81c2f941254646a0e77e6ca3f9a7b95710772.tar.gz
prosody-eed81c2f941254646a0e77e6ca3f9a7b95710772.zip
util.sql: Make set_encoding() return failure of SET NAMES
Diffstat (limited to 'util/sql.lua')
-rw-r--r--util/sql.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/util/sql.lua b/util/sql.lua
index d0da9302..6622ad56 100644
--- a/util/sql.lua
+++ b/util/sql.lua
@@ -279,7 +279,13 @@ function engine:set_encoding() -- to UTF-8
set_names_query = set_names_query:gsub(";$", (" COLLATE '%s';"):format(charset.."_bin"));
end
self.charset = charset;
- return self:transaction(function() return self:execute(set_names_query:format(charset)); end);
+ log("debug", "Using encoding '%s' for database connection", charset);
+ local ok, err = self:transaction(function() return self:execute(set_names_query:format(charset)); end);
+ if not ok then
+ return ok, err;
+ end
+
+ return true;
end
local engine_mt = { __index = engine };