Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions mycli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ def show_suggestion_tip() -> bool:

def output_res(results: Generator[SQLResult], start: float) -> None:
nonlocal mutating
result_count = 0
result_count = watch_count = 0
for result in results:
title = result.title
cur = result.results
Expand All @@ -915,13 +915,15 @@ def output_res(results: Generator[SQLResult], start: float) -> None:
# If this is a watch query, offset the start time on the 2nd+ iteration
# to account for the sleep duration
if command is not None and command["name"] == "watch":
if result_count > 0:
if watch_count > 0:
try:
watch_seconds = float(command["seconds"])
start += watch_seconds
except ValueError as e:
self.echo(f"Invalid watch sleep time provided ({e}).", err=True, fg="red")
sys.exit(1)
else:
watch_count += 1
if is_select(status) and isinstance(cur, Cursor) and cur.rowcount > threshold:
self.echo(
f"The result set has more than {threshold} rows.",
Expand Down