diff options
author | Kegsay <kegsay@gmail.com> | 2015-03-02 12:02:48 +0000 |
---|---|---|
committer | Kegsay <kegsay@gmail.com> | 2015-03-02 12:02:48 +0000 |
commit | 33f93d389ec5989f2e4ac75046e4df7df4590abc (patch) | |
tree | 8e4cc0565aaafe7b842b937f888f185dcab3a1e5 /synapse/storage/_base.py | |
parent | SYWEB-278 Don't allow rules with no rule_id. (diff) | |
parent | PEP8 (diff) | |
download | synapse-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.py | 22 |
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, |