little error in mysql plugin

This commit is contained in:
Bastian Schroll 2015-05-20 22:15:56 +02:00
parent 463bcefa81
commit f5dba0318f

View file

@ -33,7 +33,7 @@ def run(typ,freq,data):
elif typ == "ZVEI": elif typ == "ZVEI":
#data = {"zvei":zvei_id} #data = {"zvei":zvei_id}
cursor.execute("INSERT INTO "+globals.config.get("MySQL","tableZVEI")+" (time,zvei) VALUES (NOW(),"+data["zvei"]+")") cursor.execute("INSERT INTO "+globals.config.get("MySQL","tableZVEI")+" (time,zvei) VALUES (NOW(),%s)",(data["zvei"]))
elif typ == "POC": elif typ == "POC":
#data = {"ric":poc_id, "function":poc_sub, "msg":poc_text} #data = {"ric":poc_id, "function":poc_sub, "msg":poc_text}
@ -45,6 +45,7 @@ def run(typ,freq,data):
logging.exception("cannot Insert %s", typ) logging.exception("cannot Insert %s", typ)
finally: finally:
logging.debug("close MySQL")
cursor.close() cursor.close()
connection.close() #Close connection in every case connection.close() #Close connection in every case
except: except: