Software / code / prosody
Comparison
util/sql.lua @ 5739:2e9ad9cb206f
util.sql: Set charset and collation for MySQL when creating tables
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 11 Jul 2013 22:07:55 +0200 |
| parent | 5494:9916f0a2d178 |
| child | 5742:3c57c2281087 |
comparison
equal
deleted
inserted
replaced
| 5738:2fb4f2ea27f4 | 5739:2e9ad9cb206f |
|---|---|
| 262 if i ~= #table.c then sql = sql..", "; end | 262 if i ~= #table.c then sql = sql..", "; end |
| 263 end | 263 end |
| 264 sql = sql.. ");" | 264 sql = sql.. ");" |
| 265 if self.params.driver == "PostgreSQL" then | 265 if self.params.driver == "PostgreSQL" then |
| 266 sql = sql:gsub("`", "\""); | 266 sql = sql:gsub("`", "\""); |
| 267 elseif self.params.driver == "MySQL" then | |
| 268 sql = sql:gsub(";$", " CHARACTER SET 'utf8' COLLATE 'utf8_bin';"); | |
| 267 end | 269 end |
| 268 local success,err = self:execute(sql); | 270 local success,err = self:execute(sql); |
| 269 if not success then return success,err; end | 271 if not success then return success,err; end |
| 270 for i,v in ipairs(table.__table__) do | 272 for i,v in ipairs(table.__table__) do |
| 271 if is_index(v) then | 273 if is_index(v) then |