From 6458cc30bc221022a828850f68bb1db246a98565 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Fri, 12 Oct 2012 14:27:45 +0200 Subject: [PATCH] fixup --- db_add.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/db_add.py b/db_add.py index 11e5d23..64e5698 100755 --- a/db_add.py +++ b/db_add.py @@ -26,16 +26,17 @@ def db_add_job(con, name): 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): -- 2.39.5