Skip to content

Commit eedfef6

Browse files
committed
Don't display rows affected when the connector tells us -1
We have been displaying "0 rows affected" in this case, but that is misleading for CTEs, which could affect any number of rows.
1 parent 4bd4234 commit eedfef6

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

litecli/sqlexecute.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,19 @@ def get_result(self, cursor):
138138
# e.g. SELECT.
139139
if cursor.description is not None:
140140
headers = [x[0] for x in cursor.description]
141-
status = "{0} row{1} in set"
141+
status = "{count} row{s} in set"
142142
cursor = list(cursor)
143143
rowcount = len(cursor)
144144
else:
145145
_logger.debug("No rows in result.")
146-
status = "Query OK, {0} row{1} affected"
147-
rowcount = 0 if cursor.rowcount == -1 else cursor.rowcount
146+
if cursor.rowcount == -1:
147+
status = "Query OK"
148+
else:
149+
status = "Query OK, {count} row{s} affected"
150+
rowcount = cursor.rowcount
148151
cursor = None
149152

150-
status = status.format(rowcount, "" if rowcount == 1 else "s")
153+
status = status.format(count=rowcount, s="" if rowcount == 1 else "s")
151154

152155
return (title, cursor, headers, status)
153156

0 commit comments

Comments
 (0)