summaryrefslogtreecommitdiffstats
path: root/sql/pg_handler.py
diff options
context:
space:
mode:
Diffstat (limited to 'sql/pg_handler.py')
-rw-r--r--sql/pg_handler.py9
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}")
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage