From: Karl O. Pinc Date: Sun, 18 Aug 2024 19:08:53 +0000 (-0500) Subject: Adjust for SQL that returns no result X-Git-Url: https://papio.biology.duke.edu/gitweb/?a=commitdiff_plain;h=5afabe59ed585d64ca0d79c5a58559109a82f049;p=pgwui_sql Adjust for SQL that returns no result --- diff --git a/src/pgwui_sql/views/sql.py b/src/pgwui_sql/views/sql.py index bab967c..c269048 100644 --- a/src/pgwui_sql/views/sql.py +++ b/src/pgwui_sql/views/sql.py @@ -158,12 +158,13 @@ class SQLHandler(pgwui_core.core.SessionDBHandler): sql_results = self.sql_results nextset = True while nextset is True: - first = True - while (row := cur.fetchone()) is not None: - if first: - sql_results.append(SQLResult().build_header_row(cur)) - first = False - sql_results.append(SQLResult().build_data_row(row)) + if cur.rownumber is not None: + first = True + while (row := cur.fetchone()) is not None: + if first: + sql_results.append(SQLResult().build_heading_row(cur)) + first = False + sql_results.append(SQLResult().build_data_row(row)) sql_results.append(SQLResult().build_statusmessage_row(cur)) sql_results.append(SQLResult().build_rowcount_row(cur)) nextset = cur.nextset()