Commit b5b65bd9 authored by Ismail Moumni's avatar Ismail Moumni
Browse files

Editing db_insert

parent a33d2d8d
Pipeline #1011 failed with stage
in 15 seconds
......@@ -108,7 +108,7 @@ def get_generators():
generators = {}
sql_get_new_job = "SELECT generators.tool, name, basefile, defaultValue from parameters inner join generators on parameters.idGenerator=generators.id"
mycursor = database.cursor(buffered=False)
mycursor.execute(sql_get_new_job)
è mycursor.execute(sql_get_new_job)
myresult = mycursor.fetchall()
mycursor.close()
for result in myresult:
......@@ -122,16 +122,12 @@ def db_insert(query: dict):
if(db_job_check(query) != 0):
query['id'] = str(random.getrandbits(64))
try:
print(query)
values = query.values()
print(values)
cols = query.keys()
print(cols)
sql_new_job_row = "INSERT INTO jobs (%s) VALUES ('%s');" % (", ".join(cols), "','".join(values))
print(sql_new_job_row)
mycursor = database.cursor(buffered=True)
mycursor.execute(sql_new_job_row)
print("Record inserted", mycursor.rowcount)
print("Records inserted in DB :", query.values())
database.commit()
mycursor.close()
except mysql.connector.Error as err:
......
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