summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/__init__.py6
-rw-r--r--synapse/storage/_base.py3
-rw-r--r--synapse/storage/room.py15
-rw-r--r--synapse/storage/roommember.py1
-rw-r--r--synapse/storage/stream.py2
5 files changed, 18 insertions, 9 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py
index 750e86040e..ad36d14a36 100644
--- a/synapse/storage/__init__.py
+++ b/synapse/storage/__init__.py
@@ -87,7 +87,11 @@ class DataStore(RoomMemberStore, RoomStore,
             "content": json.dumps(event.content),
         }
 
-        unrec = {k: v for k, v in event.get_full_dict().items() if k not in vals.keys()}
+        unrec = {
+            k: v
+            for k, v in event.get_full_dict().items()
+            if k not in vals.keys()
+        }
         vals["unrecognized_keys"] = json.dumps(unrec)
 
         yield self._simple_insert("events", vals)
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py
index 413838f798..36cc57c1b8 100644
--- a/synapse/storage/_base.py
+++ b/synapse/storage/_base.py
@@ -60,7 +60,8 @@ class SQLBaseStore(object):
             The result of decoder(results)
         """
         logger.debug(
-            "[SQL] %s  Args=%s Func=%s", query, args, decoder.__name__ if decoder else None
+            "[SQL] %s  Args=%s Func=%s",
+            query, args, decoder.__name__ if decoder else None
         )
 
         def interaction(txn):
diff --git a/synapse/storage/room.py b/synapse/storage/room.py
index 8f44b67d8c..22f2dcca45 100644
--- a/synapse/storage/room.py
+++ b/synapse/storage/room.py
@@ -87,19 +87,26 @@ class RoomStore(SQLBaseStore):
         """
 
         topic_subquery = (
-            "SELECT topics.event_id as event_id, topics.room_id as room_id, topic FROM topics "
+            "SELECT topics.event_id as event_id, "
+            "topics.room_id as room_id, topic "
+            "FROM topics "
             "INNER JOIN current_state_events as c "
             "ON c.event_id = topics.event_id "
         )
 
         name_subquery = (
-            "SELECT room_names.event_id as event_id, room_names.room_id as room_id, name FROM room_names "
+            "SELECT room_names.event_id as event_id, "
+            "room_names.room_id as room_id, name "
+            "FROM room_names "
             "INNER JOIN current_state_events as c "
             "ON c.event_id = room_names.event_id "
         )
 
+        # We use non printing ascii character US () as a seperator
         sql = (
-            "SELECT r.room_id, n.name, t.topic, group_concat(a.room_alias) FROM rooms AS r "
+            "SELECT r.room_id, n.name, t.topic, "
+            "group_concat(a.room_alias, '') "
+            "FROM rooms AS r "
             "LEFT JOIN (%(topic)s) AS t ON t.room_id = r.room_id "
             "LEFT JOIN (%(name)s) AS n ON n.room_id = r.room_id "
             "INNER JOIN room_aliases AS a ON a.room_id = r.room_id "
@@ -117,7 +124,7 @@ class RoomStore(SQLBaseStore):
                 "room_id": r[0],
                 "name": r[1],
                 "topic": r[2],
-                "aliases": r[3].split(","),
+                "aliases": r[3].split(""),
             }
             for r in rows
         ]
diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py
index a0620677b9..89c87290cf 100644
--- a/synapse/storage/roommember.py
+++ b/synapse/storage/roommember.py
@@ -62,7 +62,6 @@ class RoomMemberStore(SQLBaseStore):
 
             yield self._execute(None, sql, event.room_id, domain)
 
-
     @defer.inlineCallbacks
     def get_room_member(self, user_id, room_id):
         """Retrieve the current state of a room member.
diff --git a/synapse/storage/stream.py b/synapse/storage/stream.py
index 7c2c45e0ff..cf4b1682b6 100644
--- a/synapse/storage/stream.py
+++ b/synapse/storage/stream.py
@@ -61,7 +61,6 @@ class StreamStore(SQLBaseStore):
             defer.returnValue(([], to_key))
             return
 
-
         sql = (
             "SELECT * FROM events as e WHERE "
             "((room_id IN (%(current)s)) OR "
@@ -90,7 +89,6 @@ class StreamStore(SQLBaseStore):
 
         ret = [self._parse_event_from_row(r) for r in rows]
 
-
         if rows:
             if from_key < to_key:
                 key = max([r["ordering"] for r in rows])