sql: pop offset/limit/order_by when doing simple count(*) query

This commit is contained in:
Lex Berezhny 2018-10-08 10:37:52 -04:00
parent 9cea8d2725
commit 9aa22e1071

View file

@ -362,6 +362,9 @@ class BaseDatabase(SQLiteMixin):
@defer.inlineCallbacks
def get_transaction_count(self, **constraints):
constraints.pop('offset', None)
constraints.pop('limit', None)
constraints.pop('order_by', None)
count = yield self.select_transactions('count(*)', **constraints)
return count[0][0]
@ -398,6 +401,9 @@ class BaseDatabase(SQLiteMixin):
@defer.inlineCallbacks
def get_txo_count(self, **constraints):
constraints.pop('offset', None)
constraints.pop('limit', None)
constraints.pop('order_by', None)
count = yield self.select_txos('count(*)', **constraints)
return count[0][0]