Software /
code /
prosody
Changeset
5889:ea6a3adb6a69
util.sql: Check what encoding SQLite3 uses
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 29 Oct 2013 11:43:49 +0100 |
parents | 5888:f3e408ae59a6 |
children | 5890:544ca3d94596 |
files | util/sql.lua |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/util/sql.lua Tue Oct 29 11:42:55 2013 +0100 +++ b/util/sql.lua Tue Oct 29 11:43:49 2013 +0100 @@ -290,8 +290,14 @@ return success; end function engine:set_encoding() -- to UTF-8 - if self.params.driver == "SQLite3" then return end local driver = self.params.driver; + if driver == "SQLite3" then + return self:transaction(function() + if self:select"PRAGMA encoding;"()[1] == "UTF-8" then + self.charset = "utf8"; + end + end); + end local set_names_query = "SET NAMES '%s';" local charset = "utf8"; if driver == "MySQL" then