diff --git a/Pool_old/Lotto2SQL_V2.py b/Pool_old/Lotto2SQL_V2.py index 1e7ff8d..830c159 100644 --- a/Pool_old/Lotto2SQL_V2.py +++ b/Pool_old/Lotto2SQL_V2.py @@ -91,6 +91,9 @@ if 'Samstag,' in datum: resp = cursor.execute(sql_q) if resp == 0: cursor.execute(sql) + connection.commit() + cursor.close() + connection.close() if 'Mittwoch,' in datum: sql = "INSERT INTO `mittwoch`(`datum`, `z1`, `z2`, `z3`, `z4`, `z5`, `z6`, `sz`, `super6`, `spiel77`) VALUES" \ diff --git a/lotto2py.py b/lotto2py.py index 9354d40..bf155df 100644 --- a/lotto2py.py +++ b/lotto2py.py @@ -193,21 +193,57 @@ def SQLfreitag(data): resp = cursor.execute(sql_q) if resp == 0: cursor.execute(sql) - print(resp) + + connection.commit() + cursor.close() + connection.close() +def SQLsamstag(data): + connection = pymysql.connect(db="hubobel", + user="hubobel", + passwd="polier2003", + host='10.0.1.123', charset='utf8') + cursor = connection.cursor() + sql = "INSERT INTO `samstag`(`datum`, `z1`, `z2`, `z3`, `z4`, `z5`, `z6`, `sz`, `super6`, `spiel77`) VALUES" \ + " ('" + str(data['Datum']) + "','" + str(data['Z1']) + "','" + str(data['Z2']) + "','" + str(data['Z3']) + \ + "','" + str(data['Z4']) + "','" + str(data['Z5']) + "','" + str(data['Z6']) + "','" + str(data['Superzahl']) + \ + "','" + str(data['Super6']) + "','" + str(data['Spiel77']) + "')" + sql_q = "SELECT * FROM samstag WHERE datum like '%" + data['Datum'] + "%'" + resp = cursor.execute(sql_q) + if resp == 0: + cursor.execute(sql) + connection.commit() + cursor.close() + connection.close() +def SQLmittwoch(data): + connection = pymysql.connect(db="hubobel", + user="hubobel", + passwd="polier2003", + host='10.0.1.123', charset='utf8') + cursor = connection.cursor() + sql = "INSERT INTO `mittwoch`(`datum`, `z1`, `z2`, `z3`, `z4`, `z5`, `z6`, `sz`, `super6`, `spiel77`) VALUES" \ + " ('" + str(data['Datum']) + "','" + str(data['Z1']) + "','" + str(data['Z2']) + "','" + str(data['Z3']) + \ + "','" + str(data['Z4']) + "','" + str(data['Z5']) + "','" + str(data['Z6']) + "','" + str(data['Superzahl']) + \ + "','" + str(data['Super6']) + "','" + str(data['Spiel77']) + "')" + sql_q = "SELECT * FROM samstag WHERE datum like '%" + data['Datum'] + "%'" + resp = cursor.execute(sql_q) + if resp == 0: + cursor.execute(sql) connection.commit() cursor.close() connection.close() wochentag = datetime.today().weekday() -wochentag = 1 +wochentag = 2 if wochentag == 2: Zahl = Normalziehung(582) SQLnorm(Zahl) + SQLmittwoch(Zahl) notify_telegram(str(Zahl)) elif wochentag == 5: Zahl = Normalziehung(581) SQLnorm(Zahl) + SQLsamstag(Zahl) notify_telegram(str(Zahl)) elif wochentag == 1: Zahl = Euro()