From eed81c2f941254646a0e77e6ca3f9a7b95710772 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 8 Jul 2015 15:14:24 +0100 Subject: util.sql: Make set_encoding() return failure of SET NAMES --- util/sql.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 }; -- cgit v1.2.3