summary refs log tree commit diff
path: root/synapse/storage/_base.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2017-11-22 18:02:15 +0000
committerRichard van der Hoff <richard@matrix.org>2017-11-22 18:02:15 +0000
commit2908f955d12e8c9d6081a8d72096c85683fe1ebf (patch)
tree1bcab40e5b0fb94bc961f3f826d29358400ee546 /synapse/storage/_base.py
parentFix error on sqlite 3.7 (diff)
downloadsynapse-2908f955d12e8c9d6081a8d72096c85683fe1ebf.tar.xz
Check database in has_completed_background_updates
so that the right thing happens on workers.
Diffstat (limited to 'synapse/storage/_base.py')
-rw-r--r--synapse/storage/_base.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py
index e6eefdd6fe..476c84c621 100644
--- a/synapse/storage/_base.py
+++ b/synapse/storage/_base.py
@@ -600,20 +600,18 @@ class SQLBaseStore(object):
 
     @staticmethod
     def _simple_select_onecol_txn(txn, table, keyvalues, retcol):
-        if keyvalues:
-            where = "WHERE %s" % " AND ".join("%s = ?" % k for k in keyvalues.iterkeys())
-        else:
-            where = ""
-
         sql = (
-            "SELECT %(retcol)s FROM %(table)s %(where)s"
+            "SELECT %(retcol)s FROM %(table)s"
         ) % {
             "retcol": retcol,
             "table": table,
-            "where": where,
         }
 
-        txn.execute(sql, keyvalues.values())
+        if keyvalues:
+            sql += "WHERE %s" % " AND ".join("%s = ?" % k for k in keyvalues.iterkeys())
+            txn.execute(sql, keyvalues.values())
+        else:
+            txn.execute(sql)
 
         return [r[0] for r in txn]
 
@@ -624,7 +622,7 @@ class SQLBaseStore(object):
 
         Args:
             table (str): table name
-            keyvalues (dict): column names and values to select the rows with
+            keyvalues (dict|None): column names and values to select the rows with
             retcol (str): column whos value we wish to retrieve.
 
         Returns: