test with databaseController
This commit is contained in:
parent
33333561f3
commit
c6508fd516
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue