Skip to content

Commit 3a15b41

Browse files
author
David Stirling
committed
Fix count statements to work with MySQL and SQLite
1 parent 0f6614b commit 3a15b41

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

cpa/dbconnect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,7 +1627,7 @@ def CreateObjectCheckedTable(self):
16271627

16281628
# Try to get a quick count of how many table rows we started with.
16291629
try:
1630-
query = f"SELECT COUNT() FROM {object_table}"
1630+
query = f"SELECT COUNT(*) FROM {object_table}"
16311631
initial_count = self.execute(query)[0][0]
16321632
except:
16331633
logging.error("Unable to count table rows")
@@ -1685,7 +1685,7 @@ def CreateObjectCheckedTable(self):
16851685
self.Commit()
16861686
# Inform user of what we did. Also check whether we nuked the table.
16871687
try:
1688-
query = f"SELECT COUNT() FROM {p.object_table}"
1688+
query = f"SELECT COUNT(*) FROM {p.object_table}"
16891689
res = self.execute(query)[0][0]
16901690
if res == 0:
16911691
logging.error("Table checking removed all rows, you may have an empty column in your database. "

0 commit comments

Comments
 (0)