From c6508fd516916d84ff3a696e550b7f25415e2cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Thu, 19 Dec 2019 19:46:04 +0100 Subject: [PATCH] test with databaseController --- geruecht/controller/databaseController.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/geruecht/controller/databaseController.py b/geruecht/controller/databaseController.py index 3d5f98f..10fbb6d 100644 --- a/geruecht/controller/databaseController.py +++ b/geruecht/controller/databaseController.py @@ -115,12 +115,9 @@ class DatabaseController(metaclass=Singleton): try: cursor.execute("select * from creditList where user_id={} and year_date={}".format(creditlist.user_id, creditlist.year)) data = cursor.fetchall() - self.db.close() if len(data) == 0: self.createCreditList(creditlist.user_id, creditlist.year) - self.connect() - cursor = self.db.cursor() - cursor.execute("update creditList set jan_guthaben={}, jan_schulden={},feb_guthaben={}, feb_schulden={}, maer_guthaben={}, maer_schulden={}, apr_guthaben={}, apr_schulden={}, mai_guthaben={}, mai_schulden={}, jun_guthaben={}, jun_schulden={}, jul_guthaben={}, jul_schulden={}, aug_guthaben={}, aug_schulden={},sep_guthaben={}, sep_schulden={},okt_guthaben={}, okt_schulden={}, nov_guthaben={}, nov_schulden={}, dez_guthaben={}, dez_schulden={}, last_schulden={} where year_date={} and user_id={}".format(creditlist.jan_guthaben, creditlist.jan_schulden, + sql = "update creditList set jan_guthaben={}, jan_schulden={},feb_guthaben={}, feb_schulden={}, maer_guthaben={}, maer_schulden={}, apr_guthaben={}, apr_schulden={}, mai_guthaben={}, mai_schulden={}, jun_guthaben={}, jun_schulden={}, jul_guthaben={}, jul_schulden={}, aug_guthaben={}, aug_schulden={},sep_guthaben={}, sep_schulden={},okt_guthaben={}, okt_schulden={}, nov_guthaben={}, nov_schulden={}, dez_guthaben={}, dez_schulden={}, last_schulden={} where year_date={} and user_id={}".format(creditlist.jan_guthaben, creditlist.jan_schulden, creditlist.feb_guthaben, creditlist.feb_schulden, creditlist.maer_guthaben, creditlist.maer_schulden, creditlist.apr_guthaben, creditlist.apr_schulden, @@ -132,7 +129,9 @@ class DatabaseController(metaclass=Singleton): creditlist.okt_guthaben, creditlist.okt_schulden, creditlist.nov_guthaben, creditlist.nov_schulden, creditlist.dez_guthaben, creditlist.dez_schulden, - creditlist.last_schulden, creditlist.year, creditlist.user_id)) + creditlist.last_schulden, creditlist.year, creditlist.user_id) + print(sql) + cursor.execute(sql) self.db.close() except Exception as err: self.db.rollback()