Diff

util/sql.lua @ 6759:fb952032f83e

util.sql: Create table with same charset as the charset we selected for our connection, also use corresponding _bin collation
author Matthew Wild <mwild1@gmail.com>
date Wed, 08 Jul 2015 15:04:23 +0100
parent 6758:88b89facc3c9
child 6760:e45a58c72609
line wrap: on
line diff
--- a/util/sql.lua	Tue Jul 07 17:43:14 2015 +0100
+++ b/util/sql.lua	Wed Jul 08 15:04:23 2015 +0100
@@ -245,7 +245,7 @@
 	if self.params.driver == "PostgreSQL" then
 		sql = sql:gsub("`", "\"");
 	elseif self.params.driver == "MySQL" then
-		sql = sql:gsub(";$", " CHARACTER SET 'utf8' COLLATE 'utf8_bin';");
+		sql = sql:gsub(";$", (" CHARACTER SET '%s' COLLATE '%s_bin';"):format(self.charset, self.charset));
 	end
 	local success,err = self:execute(sql);
 	if not success then return success,err; end