diff options
Diffstat (limited to 'sql')
| -rw-r--r-- | sql/pg_handler.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/pg_handler.py b/sql/pg_handler.py index 68ce82c..a010407 100644 --- a/sql/pg_handler.py +++ b/sql/pg_handler.py @@ -143,8 +143,13 @@ class PostgresHandler: cursor.execute(query) else: cursor.execute(query, data) - result = cursor.fetchall() - return result + query_type = query.strip().upper().split()[0] + if query_type == 'SELECT': + result = cursor.fetchall() + return result + else: + self._connection.commit() + return True except Error as e: self._connection.rollback() print(f"Failed to execute query: {query}") |
