Commit 5a0cc0fe authored by Francois Mares's avatar Francois Mares
Browse files

Replace SQL.py

parent a69f29a9
......@@ -66,7 +66,7 @@ class SQL():
print("Message système :", e)
self._connexion.rollback()
def _requete_sql(self,sql):
def _lecture_sql(self,sql):
self._verify_connexion_or_new()
if self._connexion:
try:
......@@ -78,14 +78,29 @@ class SQL():
print("Message système :", e)
self._connexion.rollback()
def _ecriture_sql(self,sql):
self._verify_connexion_or_new()
if self._connexion:
try:
cur = self._connexion.cursor()
cur.execute(sql)
self._connexion.commit()
except psycopg2.Error as e:
print("Message système :", e)
self._connexion.rollback()
def _insert_into(self,class_name,values):
print(values)
sql="INSERT INTO "+class_name+" VALUES("
for value in values:
sql+="'"+value+"',"
if type(value) == int:
sql+=str(value)+","
else:
sql+="'"+value+"',"
sql=sql[:-1]
sql+=")"
self.requete_sql(sql)
self._ecriture_sql(sql)
......
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