Software /
code /
prosody
Changeset
6763:e961ac4efbb3
util.sql: Make set_encoding() return failure of SET NAMES
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 08 Jul 2015 15:14:24 +0100 |
parents | 6762:ea43a5af31ca |
children | 6764:9f2b1e0bba90 |
files | util/sql.lua |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/util/sql.lua Wed Jul 08 15:10:25 2015 +0100 +++ b/util/sql.lua Wed Jul 08 15:14:24 2015 +0100 @@ -279,7 +279,13 @@ 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 };