Software /
code /
prosody
Comparison
util/sql.lua @ 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 |
parent | 6762:ea43a5af31ca |
child | 6764:9f2b1e0bba90 |
comparison
equal
deleted
inserted
replaced
6762:ea43a5af31ca | 6763:e961ac4efbb3 |
---|---|
277 local row = ok and charsets(); | 277 local row = ok and charsets(); |
278 charset = row and row[1] or charset; | 278 charset = row and row[1] or charset; |
279 set_names_query = set_names_query:gsub(";$", (" COLLATE '%s';"):format(charset.."_bin")); | 279 set_names_query = set_names_query:gsub(";$", (" COLLATE '%s';"):format(charset.."_bin")); |
280 end | 280 end |
281 self.charset = charset; | 281 self.charset = charset; |
282 return self:transaction(function() return self:execute(set_names_query:format(charset)); end); | 282 log("debug", "Using encoding '%s' for database connection", charset); |
283 local ok, err = self:transaction(function() return self:execute(set_names_query:format(charset)); end); | |
284 if not ok then | |
285 return ok, err; | |
286 end | |
287 | |
288 return true; | |
283 end | 289 end |
284 local engine_mt = { __index = engine }; | 290 local engine_mt = { __index = engine }; |
285 | 291 |
286 function db2uri(params) | 292 function db2uri(params) |
287 return build_url{ | 293 return build_url{ |