0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-14 23:33:53 +01:00

txn.execute doesn't return cursors

This commit is contained in:
Erik Johnston 2015-04-29 16:43:39 +01:00
parent 884fb88e28
commit 0337eaf321

View file

@ -355,11 +355,11 @@ class ApplicationServiceTransactionStore(SQLBaseStore):
# being sent) # being sent)
last_txn_id = self._get_last_txn(txn, service.id) last_txn_id = self._get_last_txn(txn, service.id)
result = txn.execute( txn.execute(
"SELECT MAX(txn_id) FROM application_services_txns WHERE as_id=?", "SELECT MAX(txn_id) FROM application_services_txns WHERE as_id=?",
(service.id,) (service.id,)
) )
highest_txn_id = result.fetchone()[0] highest_txn_id = txn.fetchone()[0]
if highest_txn_id is None: if highest_txn_id is None:
highest_txn_id = 0 highest_txn_id = 0
@ -460,11 +460,11 @@ class ApplicationServiceTransactionStore(SQLBaseStore):
) )
def _get_last_txn(self, txn, service_id): def _get_last_txn(self, txn, service_id):
result = txn.execute( txn.execute(
"SELECT last_txn FROM application_services_state WHERE as_id=?", "SELECT last_txn FROM application_services_state WHERE as_id=?",
(service_id,) (service_id,)
) )
last_txn_id = result.fetchone() last_txn_id = txn.fetchone()
if last_txn_id is None or last_txn_id[0] is None: # no row exists if last_txn_id is None or last_txn_id[0] is None: # no row exists
return 0 return 0
else: else: