This commit is contained in:
ada-dmitry
2024-04-28 13:37:53 +03:00
parent 7cd1ab1f2e
commit 308b719963
6 changed files with 21 additions and 19 deletions
-9
View File
@@ -38,14 +38,6 @@ class DbTable:
cur.execute(sql)
self.dbconn.conn.commit()
return
def delete(self, val):
sql = "DELETE FROM " + self.table_name()
sql += " WHERE " + "".join(self.column_names_without_id())
sql += "=" + "'" + "".join(val) + "';"
cur = self.dbconn.conn.cursor()
cur.execute(sql)
self.dbconn.conn.commit()
def drop(self):
sql = "DROP TABLE IF EXISTS " + self.table_name()
@@ -66,7 +58,6 @@ class DbTable:
cur = self.dbconn.conn.cursor()
try:
cur.execute(sql)
self.dbconn.conn.commit()
except psycopg2.errors.UniqueViolation:
self.dbconn.conn.rollback()
return