Commit 1b1dd05d authored by Francois Mares's avatar Francois Mares
Browse files

Replace SQL.py

parent 186174d1
......@@ -19,38 +19,12 @@ class SQL():
if(USER):
self._USER=USER
# _PROTECTED
def _connexion(self):
return psycopg2.connect(f"dbname='{self._DATABASE}' user ='{self._USER}' host='{self._HOST}' password='{self._PASSWORD}'")
def creation_bdd(self):
try :
connexion = self._connexion()
cur = connexion.cursor()
cur.execute(open("../SQL/TABLE.sql", "r").read())
connexion.commit()
return
except psycopg2.Error as e:
print("Message système :", e)
def suppression_bdd(self):
try :
connexion = self._connexion()
cur = connexion.cursor()
cur.execute(open("../SQL/DELETE.sql", "r").read())
connexion.commit()
return
except psycopg2.Error as e:
print("Message système :", e)
def insertion_bdd(self):
try :
connexion = self._connexion()
cur = connexion.cursor()
cur.execute(open("../SQL/DATA.sql", "r").read())
connexion.commit()
return
except psycopg2.Error as e:
print("Message système :", e)
# PUBLIC:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment