mirror of
https://github.com/LBRYFoundation/lbry-sdk.git
synced 2025-08-30 17:01:28 +00:00
sql: pop offset/limit/order_by when doing simple count(*) query
This commit is contained in:
parent
9cea8d2725
commit
9aa22e1071
1 changed files with 6 additions and 0 deletions
|
@ -362,6 +362,9 @@ class BaseDatabase(SQLiteMixin):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_transaction_count(self, **constraints):
|
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)
|
count = yield self.select_transactions('count(*)', **constraints)
|
||||||
return count[0][0]
|
return count[0][0]
|
||||||
|
|
||||||
|
@ -398,6 +401,9 @@ class BaseDatabase(SQLiteMixin):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_txo_count(self, **constraints):
|
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)
|
count = yield self.select_txos('count(*)', **constraints)
|
||||||
return count[0][0]
|
return count[0][0]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue