mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-01-23 00:30:14 +01:00
Update MySQL.py
INSERT in die Pocsag Tabelle schlägt fehl, da function bei MySQL 8.0 als reserviertes Wort nicht einfach als Spaltenname genutzt werden kann. Siehe auch https://dev.mysql.com/doc/refman/8.0/en/keywords.html Daher habe ich nun die Spaltennamen escaped, damit funktioniert wieder ein INSERT in MySQL 8.0 Datenbanken
This commit is contained in:
parent
016bd906c3
commit
9e0e448520
|
|
@ -104,21 +104,21 @@ def run(typ,freq,data):
|
|||
logging.debug("Insert %s", typ)
|
||||
|
||||
if typ == "FMS":
|
||||
cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableFMS")+" (time, fms, status, direction, directionText, tsi, description) VALUES (FROM_UNIXTIME(%s),%s,%s,%s,%s,%s,%s)", (data["timestamp"], data["fms"], data["status"], data["direction"], data["directionText"], data["tsi"], data["description"]))
|
||||
cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableFMS")+" (`time`, `fms`, `status`, `direction`, `directionText`, `tsi`, `description`) VALUES (FROM_UNIXTIME(%s),%s,%s,%s,%s,%s,%s)", (data["timestamp"], data["fms"], data["status"], data["direction"], data["directionText"], data["tsi"], data["description"]))
|
||||
|
||||
elif typ == "ZVEI":
|
||||
cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableZVEI")+" (time, zvei, description) VALUES (FROM_UNIXTIME(%s),%s,%s)", (data["timestamp"], data["zvei"], data["description"]))
|
||||
cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableZVEI")+" (`time`, `zvei`, `description`) VALUES (FROM_UNIXTIME(%s),%s,%s)", (data["timestamp"], data["zvei"], data["description"]))
|
||||
|
||||
elif typ == "POC":
|
||||
if isSignal(data["ric"]):
|
||||
if globalVars.config.getint("POC","netIdent_history"):
|
||||
cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');")
|
||||
cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (`time`,`ric`) VALUES (NOW(), '"+data["ric"]+"');")
|
||||
else:
|
||||
cursor.execute("UPDATE "+globalVars.config.get("MySQL","tableSIG")+" SET time = NOW() WHERE ric = '"+data["ric"]+"';")
|
||||
if cursor.rowcount == 0:
|
||||
cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');")
|
||||
cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (`time`,`ric`) VALUES (NOW(), '"+data["ric"]+"');")
|
||||
else:
|
||||
cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tablePOC")+" (time, ric, function, functionChar, msg, bitrate, description) VALUES (FROM_UNIXTIME(%s),%s,%s,%s,%s,%s,%s)", (data["timestamp"], data["ric"], data["function"], data["functionChar"], data["msg"], data["bitrate"], data["description"]))
|
||||
cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tablePOC")+" (`time`, `ric`, `function`, `functionChar`, `msg`, `bitrate`, `description`) VALUES (FROM_UNIXTIME(%s),%s,%s,%s,%s,%s,%s)", (data["timestamp"], data["ric"], data["function"], data["functionChar"], data["msg"], data["bitrate"], data["description"]))
|
||||
|
||||
else:
|
||||
logging.warning("Invalid Typ: %s", typ)
|
||||
|
|
|
|||
Loading…
Reference in a new issue