From 7e10077d336e6588bf6e5f1a628e8f29b4c1936b Mon Sep 17 00:00:00 2001 From: thezero Date: Mon, 5 Nov 2018 22:57:24 +0100 Subject: [PATCH] remove executemany and use a for each -> execute --- db.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/db.py b/db.py index b3c8b1e..a159cdc 100644 --- a/db.py +++ b/db.py @@ -71,12 +71,13 @@ class VVVVIDatabase(): def insert_episodes(self, eps): con = sqlite3.connect(self.path) cur = con.cursor() - try: - cur.executemany("INSERT INTO episodes (id, serie_id, season_id, type, cdn_url) VALUES (?, ?, ?, ?, ?);", eps) - con.commit() - con.close() - return True - except sqlite3.IntegrityError: - # episodi gia' presenti - pass + for ep in eps: + try: + cur.execute("INSERT INTO episodes (id, serie_id, season_id, type, cdn_url) VALUES (?, ?, ?, ?, ?);", ep) + con.commit() + con.close() + return True + except sqlite3.IntegrityError: + # episodi gia' presenti + pass return False