util.sql: Set charset and collation for MySQL when creating tables
authorKim Alvefur <zash@zash.se>
Thu, 11 Jul 2013 20:07:55 +0000 (22:07 +0200)
committerKim Alvefur <zash@zash.se>
Thu, 11 Jul 2013 20:07:55 +0000 (22:07 +0200)
util/sql.lua

index f360d6d09d04f07b8d04b3b511719ad334856422..771df7aae0ee6eed49e21e2a02d647f3408ce0dc 100644 (file)
@@ -264,6 +264,8 @@ function engine:_create_table(table)
        sql = sql.. ");"
        if self.params.driver == "PostgreSQL" then
                sql = sql:gsub("`", "\"");
+       elseif self.params.driver == "MySQL" then
+               sql = sql:gsub(";$", " CHARACTER SET 'utf8' COLLATE 'utf8_bin';");
        end
        local success,err = self:execute(sql);
        if not success then return success,err; end