From b88f6b6ac40ec8e3e5cbe7c8589f4e95e388a86a Mon Sep 17 00:00:00 2001 From: mrepetto Date: Wed, 8 Jan 2020 15:27:33 -0300 Subject: [PATCH] fixed issue with rowcount = 0 when using count queries --- dejavu/base_classes/common_database.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dejavu/base_classes/common_database.py b/dejavu/base_classes/common_database.py index 517cda7..e884285 100644 --- a/dejavu/base_classes/common_database.py +++ b/dejavu/base_classes/common_database.py @@ -59,7 +59,7 @@ class CommonDatabase(BaseDatabase, metaclass=abc.ABCMeta): :return: the amount of songs in the database. """ - with self.cursor() as cur: + with self.cursor(buffered=True) as cur: cur.execute(self.SELECT_UNIQUE_SONG_IDS) count = cur.fetchone()[0] if cur.rowcount != 0 else 0 @@ -71,7 +71,7 @@ class CommonDatabase(BaseDatabase, metaclass=abc.ABCMeta): :return: the number of fingerprints in the database. """ - with self.cursor() as cur: + with self.cursor(buffered=True) as cur: cur.execute(self.SELECT_NUM_FINGERPRINTS) count = cur.fetchone()[0] if cur.rowcount != 0 else 0