cur.execute("ROLLBACK TO a") # have to rollback after failed command
cur.execute("SELECT id FROM jenkins_job WHERE name='%s'" % (name))
#logger.debug("INSERT INTO jenkins_job(name) VALUES('%s')" % (name))
+ con.commit()
return cur.fetchone()[0]
def db_add_build(con, db_id, number, start, end, status):
cur = con.cursor()
cur.execute("SAVEPOINT a")
try:
- cur.execute("INSERT INTO jenkins_build(jenkins_job_id, jenkins_build_number, build_start, build_end, status) VALUES(%s, %s, '%s', '%s', '%s') RETURNING id" % (db_id, number, start, end, status))
+ cur.execute("INSERT INTO jenkins_build(jenkins_job_id, jenkins_build_number, build_start, build_end, status) VALUES(%s, %s, to_timestamp('%s'), to_timestamp('%s'), '%s') RETURNING id" % (db_id, number, start, end, status))
except psycopg2.DatabaseError as e:
cur.execute("ROLLBACK TO a") # have to rollback after failed command
- logger.debug("INSERT INTO jenkins_build(jenkins_job_id, jenkins_build_number, build_start, build_end, status) VALUES(%s, %s, '%s', '%s', '%s') RETURNING id" % (db_id, number, start, end, status))
+ logger.debug("INSERT INTO jenkins_build(jenkins_job_id, jenkins_build_number, build_start, build_end, status) VALUES(%s, %s, to_timestamp('%s'), to_timestamp('%s'), '%s') RETURNING id" % (db_id, number, start, end, status))
return cur.fetchone()[0]
def db_update_build(con, db_id, end, status):