test with databaseController

This commit is contained in:
Tim Gröger 2019-12-19 19:46:04 +01:00
parent 33333561f3
commit c6508fd516
1 changed files with 4 additions and 5 deletions

View File

@ -115,12 +115,9 @@ class DatabaseController(metaclass=Singleton):
try: try:
cursor.execute("select * from creditList where user_id={} and year_date={}".format(creditlist.user_id, creditlist.year)) cursor.execute("select * from creditList where user_id={} and year_date={}".format(creditlist.user_id, creditlist.year))
data = cursor.fetchall() data = cursor.fetchall()
self.db.close()
if len(data) == 0: if len(data) == 0:
self.createCreditList(creditlist.user_id, creditlist.year) self.createCreditList(creditlist.user_id, creditlist.year)
self.connect() 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,
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,
creditlist.feb_guthaben, creditlist.feb_schulden, creditlist.feb_guthaben, creditlist.feb_schulden,
creditlist.maer_guthaben, creditlist.maer_schulden, creditlist.maer_guthaben, creditlist.maer_schulden,
creditlist.apr_guthaben, creditlist.apr_schulden, creditlist.apr_guthaben, creditlist.apr_schulden,
@ -132,7 +129,9 @@ class DatabaseController(metaclass=Singleton):
creditlist.okt_guthaben, creditlist.okt_schulden, creditlist.okt_guthaben, creditlist.okt_schulden,
creditlist.nov_guthaben, creditlist.nov_schulden, creditlist.nov_guthaben, creditlist.nov_schulden,
creditlist.dez_guthaben, creditlist.dez_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() self.db.close()
except Exception as err: except Exception as err:
self.db.rollback() self.db.rollback()