diff options
author | Matthew Wild <mwild1@gmail.com> | 2015-07-08 15:14:24 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2015-07-08 15:14:24 +0100 |
commit | 0c33175d450c4a893eb4503f22dc6c39297499aa (patch) | |
tree | a4dc5c0d0f25460ca4f90b7e19a82ee93cfa45db | |
parent | 6f02ac5ba626731184e992e55989f101d17a949c (diff) | |
download | prosody-0c33175d450c4a893eb4503f22dc6c39297499aa.tar.gz prosody-0c33175d450c4a893eb4503f22dc6c39297499aa.zip |
util.sql: Make set_encoding() return failure of SET NAMES
-rw-r--r-- | util/sql.lua | 8 |
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 }; |