# HG changeset patch # User Matthew Wild # Date 1436364380 -3600 # Node ID e45a58c7260977f1b11bc88df6e8ecd2d16d3b63 # Parent fb952032f83ed371724bd3def6eac632d59d692b util.sql: Use appropriate collation for the chosen character set - fixes MySQL silently ignoring our SET NAMES command when we use utf8mb4 diff -r fb952032f83e -r e45a58c72609 util/sql.lua --- a/util/sql.lua Wed Jul 08 15:04:23 2015 +0100 +++ b/util/sql.lua Wed Jul 08 15:06:20 2015 +0100 @@ -268,12 +268,12 @@ local set_names_query = "SET NAMES '%s';" local charset = "utf8"; if driver == "MySQL" then - set_names_query = set_names_query:gsub(";$", " COLLATE 'utf8_bin';"); local ok, charsets = self:transaction(function() return self:select"SELECT `CHARACTER_SET_NAME` FROM `information_schema`.`CHARACTER_SETS` WHERE `CHARACTER_SET_NAME` LIKE 'utf8%' ORDER BY MAXLEN DESC LIMIT 1;"; end); local row = ok and charsets(); charset = row and row[1] or charset; + 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);