Comparison

util/sql.lua @ 5919:d1cc67ed0767

util.sql: Fix previous commit
author Kim Alvefur <zash@zash.se>
date Tue, 12 Nov 2013 11:38:52 +0100
parent 5918:06106726a1f0
child 6532:a966efeb6cb3
comparison
equal deleted inserted replaced
5918:06106726a1f0 5919:d1cc67ed0767
306 local set_names_query = "SET NAMES '%s';" 306 local set_names_query = "SET NAMES '%s';"
307 local charset = "utf8"; 307 local charset = "utf8";
308 if driver == "MySQL" then 308 if driver == "MySQL" then
309 set_names_query = set_names_query:gsub(";$", " COLLATE 'utf8_bin';"); 309 set_names_query = set_names_query:gsub(";$", " COLLATE 'utf8_bin';");
310 local ok, charsets = self:transaction(function() 310 local ok, charsets = self:transaction(function()
311 return self:select"SELECT `CHARACTER_SET_NAME` FROM `CHARACTER_SETS` WHERE `information_schema`.`CHARACTER_SET_NAME` LIKE 'utf8%' ORDER BY MAXLEN DESC LIMIT 1;"; 311 return self:select"SELECT `CHARACTER_SET_NAME` FROM `information_schema`.`CHARACTER_SETS` WHERE `CHARACTER_SET_NAME` LIKE 'utf8%' ORDER BY MAXLEN DESC LIMIT 1;";
312 end); 312 end);
313 local row = ok and charsets(); 313 local row = ok and charsets();
314 charset = row and row[1] or charset; 314 charset = row and row[1] or charset;
315 end 315 end
316 self.charset = charset; 316 self.charset = charset;