summary refs log tree commit diff
path: root/synapse/storage/transactions.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-03-20 16:23:01 +0000
committerErik Johnston <erik@matrix.org>2015-03-20 16:23:01 +0000
commit4848fdbf59b7e4c28baf86179cfd753e433f4d3f (patch)
tree91c2bd508fde6087bad90ce3c79be3f20b40d21e /synapse/storage/transactions.py
parentAdd the tiniest of tiny one-element caches to get_room_events_max_id() as it'... (diff)
parentPEP8 (diff)
downloadsynapse-4848fdbf59b7e4c28baf86179cfd753e433f4d3f.tar.xz
Merge pull request #113 from matrix-org/store_rearrangement
Store rearrangement
Diffstat (limited to 'synapse/storage/transactions.py')
-rw-r--r--synapse/storage/transactions.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/synapse/storage/transactions.py b/synapse/storage/transactions.py
index 0b8a3b7a07..b777395e06 100644
--- a/synapse/storage/transactions.py
+++ b/synapse/storage/transactions.py
@@ -46,15 +46,19 @@ class TransactionStore(SQLBaseStore):
         )
 
     def _get_received_txn_response(self, txn, transaction_id, origin):
-        where_clause = "transaction_id = ? AND origin = ?"
-        query = ReceivedTransactionsTable.select_statement(where_clause)
-
-        txn.execute(query, (transaction_id, origin))
-
-        results = ReceivedTransactionsTable.decode_results(txn.fetchall())
+        result = self._simple_select_one_txn(
+            txn,
+            table=ReceivedTransactionsTable.table_name,
+            keyvalues={
+                "transaction_id": transaction_id,
+                "origin": origin,
+            },
+            retcols=ReceivedTransactionsTable.fields,
+            allow_none=True,
+        )
 
-        if results and results[0].response_code:
-            return (results[0].response_code, results[0].response_json)
+        if result and result.response_code:
+            return result["response_code"], result["response_json"]
         else:
             return None