forked from MirrorHub/synapse
Add a description to storage layer's _execute_and_decode()
This commit is contained in:
parent
cdb2e045ee
commit
099e4b88d8
5 changed files with 9 additions and 6 deletions
|
@ -450,7 +450,7 @@ class DataStore(RoomMemberStore, RoomStore,
|
||||||
else:
|
else:
|
||||||
args = (room_id, )
|
args = (room_id, )
|
||||||
|
|
||||||
results = yield self._execute_and_decode(sql, *args)
|
results = yield self._execute_and_decode("get_current_state", sql, *args)
|
||||||
|
|
||||||
events = yield self._parse_events(results)
|
events = yield self._parse_events(results)
|
||||||
defer.returnValue(events)
|
defer.returnValue(events)
|
||||||
|
@ -475,7 +475,7 @@ class DataStore(RoomMemberStore, RoomStore,
|
||||||
sql += " OR s.type = 'm.room.aliases')"
|
sql += " OR s.type = 'm.room.aliases')"
|
||||||
args = (room_id,)
|
args = (room_id,)
|
||||||
|
|
||||||
results = yield self._execute_and_decode(sql, *args)
|
results = yield self._execute_and_decode("get_current_state", sql, *args)
|
||||||
|
|
||||||
events = yield self._parse_events(results)
|
events = yield self._parse_events(results)
|
||||||
|
|
||||||
|
|
|
@ -279,7 +279,8 @@ class SQLBaseStore(object):
|
||||||
|
|
||||||
return self.runInteraction("_execute", interaction)
|
return self.runInteraction("_execute", interaction)
|
||||||
|
|
||||||
def _execute_and_decode(self, query, *args):
|
def _execute_and_decode(self, desc, query, *args):
|
||||||
|
# TODO: for now ignore desc
|
||||||
return self._execute(self.cursor_to_dict, query, *args)
|
return self._execute(self.cursor_to_dict, query, *args)
|
||||||
|
|
||||||
# "Simple" SQL API methods that operate on a single table with no JOINs,
|
# "Simple" SQL API methods that operate on a single table with no JOINs,
|
||||||
|
|
|
@ -296,7 +296,7 @@ class ApplicationServiceStore(SQLBaseStore):
|
||||||
# }
|
# }
|
||||||
# ]
|
# ]
|
||||||
services = {}
|
services = {}
|
||||||
results = yield self._execute_and_decode(sql)
|
results = yield self._execute_and_decode("_populate_cache", sql)
|
||||||
for res in results:
|
for res in results:
|
||||||
as_token = res["token"]
|
as_token = res["token"]
|
||||||
if as_token not in services:
|
if as_token not in services:
|
||||||
|
|
|
@ -37,7 +37,7 @@ class FeedbackStore(SQLBaseStore):
|
||||||
"WHERE feedback.target_event_id = ? "
|
"WHERE feedback.target_event_id = ? "
|
||||||
)
|
)
|
||||||
|
|
||||||
rows = yield self._execute_and_decode(sql, event_id)
|
rows = yield self._execute_and_decode("get_feedback_for_event", sql, event_id)
|
||||||
|
|
||||||
defer.returnValue(
|
defer.returnValue(
|
||||||
[
|
[
|
||||||
|
|
|
@ -85,7 +85,9 @@ class KeyStore(SQLBaseStore):
|
||||||
" AND key_id in (" + ",".join("?" for key_id in key_ids) + ")"
|
" AND key_id in (" + ",".join("?" for key_id in key_ids) + ")"
|
||||||
)
|
)
|
||||||
|
|
||||||
rows = yield self._execute_and_decode(sql, server_name, *key_ids)
|
rows = yield self._execute_and_decode("get_server_verify_keys", sql,
|
||||||
|
server_name, *key_ids
|
||||||
|
)
|
||||||
|
|
||||||
keys = []
|
keys = []
|
||||||
for row in rows:
|
for row in rows:
|
||||||
|
|
Loading…
Reference in a new issue