summary refs log tree commit diff
path: root/synapse/storage/_base.py
diff options
context:
space:
mode:
authorKegsay <kegsay@gmail.com>2015-03-02 12:02:48 +0000
committerKegsay <kegsay@gmail.com>2015-03-02 12:02:48 +0000
commit33f93d389ec5989f2e4ac75046e4df7df4590abc (patch)
tree8e4cc0565aaafe7b842b937f888f185dcab3a1e5 /synapse/storage/_base.py
parentSYWEB-278 Don't allow rules with no rule_id. (diff)
parentPEP8 (diff)
downloadsynapse-33f93d389ec5989f2e4ac75046e4df7df4590abc.tar.xz
Merge pull request #92 from matrix-org/application-services-event-stream
Application services event stream support
Diffstat (limited to 'synapse/storage/_base.py')
-rw-r--r--synapse/storage/_base.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py
index c98dd36aed..3725c9795d 100644
--- a/synapse/storage/_base.py
+++ b/synapse/storage/_base.py
@@ -450,7 +450,8 @@ class SQLBaseStore(object):
 
         Args:
             table : string giving the table name
-            keyvalues : dict of column names and values to select the rows with
+            keyvalues : dict of column names and values to select the rows with,
+            or None to not apply a WHERE clause.
             retcols : list of strings giving the names of the columns to return
         """
         return self.runInteraction(
@@ -469,13 +470,20 @@ class SQLBaseStore(object):
             keyvalues : dict of column names and values to select the rows with
             retcols : list of strings giving the names of the columns to return
         """
-        sql = "SELECT %s FROM %s WHERE %s ORDER BY rowid asc" % (
-            ", ".join(retcols),
-            table,
-            " AND ".join("%s = ?" % (k, ) for k in keyvalues)
-        )
+        if keyvalues:
+            sql = "SELECT %s FROM %s WHERE %s ORDER BY rowid asc" % (
+                ", ".join(retcols),
+                table,
+                " AND ".join("%s = ?" % (k, ) for k in keyvalues)
+            )
+            txn.execute(sql, keyvalues.values())
+        else:
+            sql = "SELECT %s FROM %s ORDER BY rowid asc" % (
+                ", ".join(retcols),
+                table
+            )
+            txn.execute(sql)
 
-        txn.execute(sql, keyvalues.values())
         return self.cursor_to_dict(txn)
 
     def _simple_update_one(self, table, keyvalues, updatevalues,