From 7ed2ec3061b12ad79f3bd07da8758c5e41af8e5e Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 10 Apr 2015 13:41:54 +0100 Subject: Handle the fact that in sqlite binary data might be stored as unicode or bytes --- synapse/storage/engines/maria.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'synapse/storage/engines/maria.py') diff --git a/synapse/storage/engines/maria.py b/synapse/storage/engines/maria.py index 230b32858c..c934376930 100644 --- a/synapse/storage/engines/maria.py +++ b/synapse/storage/engines/maria.py @@ -27,7 +27,7 @@ class MariaEngine(object): def encode_parameter(self, param): if isinstance(param, types.BufferType): - return str(param) + return bytes(param) return param def on_new_connection(self, db_conn): @@ -45,3 +45,6 @@ class MariaEngine(object): if isinstance(error, self.module.DatabaseError): return error.sqlstate == "40001" and error.errno == 1213 return False + + def load_unicode(self, v): + return bytes(v).decode("UTF8") -- cgit 1.4.1