Software /
code /
prosody
Comparison
util/sql.lua @ 6771:60957dd5b41b
util.{interpolation,prosodyctl,sql}: Trim trailing whitespace
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 17 Jul 2015 12:43:04 +0200 |
parent | 6766:b38db4b634d3 |
child | 6777:5de6b93d0190 |
comparison
equal
deleted
inserted
replaced
6766:b38db4b634d3 | 6771:60957dd5b41b |
---|---|
283 log("debug", "Using encoding '%s' for database connection", charset); | 283 log("debug", "Using encoding '%s' for database connection", charset); |
284 local ok, err = self:transaction(function() return self:execute(set_names_query:format(charset)); end); | 284 local ok, err = self:transaction(function() return self:execute(set_names_query:format(charset)); end); |
285 if not ok then | 285 if not ok then |
286 return ok, err; | 286 return ok, err; |
287 end | 287 end |
288 | 288 |
289 if driver == "MySQL" then | 289 if driver == "MySQL" then |
290 local ok, actual_charset = self:transaction(function () | 290 local ok, actual_charset = self:transaction(function () |
291 return self:select"SHOW SESSION VARIABLES LIKE 'character_set_client'"; | 291 return self:select"SHOW SESSION VARIABLES LIKE 'character_set_client'"; |
292 end); | 292 end); |
293 for row in actual_charset do | 293 for row in actual_charset do |
295 log("error", "MySQL %s is actually %q (expected %q)", row[1], row[2], charset); | 295 log("error", "MySQL %s is actually %q (expected %q)", row[1], row[2], charset); |
296 return false, "Failed to set connection encoding"; | 296 return false, "Failed to set connection encoding"; |
297 end | 297 end |
298 end | 298 end |
299 end | 299 end |
300 | 300 |
301 return true; | 301 return true; |
302 end | 302 end |
303 local engine_mt = { __index = engine }; | 303 local engine_mt = { __index = engine }; |
304 | 304 |
305 function db2uri(params) | 305 function db2uri(params) |