Software / code / prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
| 6758:88b89facc3c9 | 6759:fb952032f83e |
|---|---|
| 243 end | 243 end |
| 244 sql = sql.. ");" | 244 sql = sql.. ");" |
| 245 if self.params.driver == "PostgreSQL" then | 245 if self.params.driver == "PostgreSQL" then |
| 246 sql = sql:gsub("`", "\""); | 246 sql = sql:gsub("`", "\""); |
| 247 elseif self.params.driver == "MySQL" then | 247 elseif self.params.driver == "MySQL" then |
| 248 sql = sql:gsub(";$", " CHARACTER SET 'utf8' COLLATE 'utf8_bin';"); | 248 sql = sql:gsub(";$", (" CHARACTER SET '%s' COLLATE '%s_bin';"):format(self.charset, self.charset)); |
| 249 end | 249 end |
| 250 local success,err = self:execute(sql); | 250 local success,err = self:execute(sql); |
| 251 if not success then return success,err; end | 251 if not success then return success,err; end |
| 252 for i,v in ipairs(table.__table__) do | 252 for i,v in ipairs(table.__table__) do |
| 253 if is_index(v) then | 253 if is_index(v) then |