Skip to content

Instantly share code, notes, and snippets.

@kuc-arc-f
Created April 28, 2015 09:06

Revisions

  1. kuc-arc-f created this gist Apr 28, 2015.
    19 changes: 19 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@

    def saveSensor(self, getDat, datMc):
    ret=False
    clsConst = com_appConst.appConstClass()
    connection = MySQLdb.connect(host=clsConst.mHost, db=clsConst.mDB_NAME, user=clsConst.mUser, passwd=clsConst.mPass, charset="utf8")
    if(datMc["vnum_1"]==1):
    cursor = connection.cursor()
    sSql=u"INSERT INTO t_sensors (mc_id"
    sSql=sSql+",vnum"
    sSql=sSql+",snum"
    sSql=sSql+",created"
    sSql=sSql+") values ("
    sSql=sSql+getDat["mc_id"]
    sSql=sSql+",1"
    sSql=sSql+","+getDat["snum_1"]
    sSql=sSql+",now() );"
    cursor.execute(sSql)
    connection.commit()
    cursor.close()