Comparison

util/sql.lua @ 7312:b4e99602ae75

util.sql: Charset should be innocent until proven guilty (initialize charset_ok to true), fixes bug introduced in 187ba2e9c012
author Matthew Wild <mwild1@gmail.com>
date Wed, 23 Mar 2016 12:17:28 +0000
parent 7306:98c4c3a2b536
child 7317:a2dce746599b
comparison
equal deleted inserted replaced
7311:e9526dd3e8fc 7312:b4e99602ae75
326 326
327 if driver == "MySQL" then 327 if driver == "MySQL" then
328 local ok, actual_charset = self:transaction(function () 328 local ok, actual_charset = self:transaction(function ()
329 return self:select"SHOW SESSION VARIABLES LIKE 'character_set_client'"; 329 return self:select"SHOW SESSION VARIABLES LIKE 'character_set_client'";
330 end); 330 end);
331 local charset_ok; 331 local charset_ok = true;
332 for row in actual_charset do 332 for row in actual_charset do
333 if row[2] ~= charset then 333 if row[2] ~= charset then
334 log("error", "MySQL %s is actually %q (expected %q)", row[1], row[2], charset); 334 log("error", "MySQL %s is actually %q (expected %q)", row[1], row[2], charset);
335 charset_ok = false; 335 charset_ok = false;
336 end 336 end