Es ist in python geschrieben. Hier ein Auszug:

class VzDb(object):

    def __init__(self, host, port, user, passwd, name):
        self.Host = host
        self.Port = port
        self.User = user
        self.Pass = passwd
        self.Name = name

    def connect(self):
self.Handle = MySQLdb.connect(host=self.Host, port=self.Port, user=self.User, passwd=self.Pass, db=self.Name)

    def save(self, uuid, value):

        cursor = self.Handle.cursor()
        query = """SELECT e.id, p.value FROM entities e
                   LEFT JOIN properties p
                   ON (e.id = p.entity_id)
                   WHERE e.uuid = '%s' AND p.pkey = 'title'""" % (uuid)
        resp = cursor.execute(query)
        if resp != 1:
raise Exception("Multiple channels in database with uuid: %s" % uuid)

         # get channel id and channel title
        (channel_id,title,) = cursor.fetchone()

        timestamp = int( time.time()*1000 )
query = "INSERT INTO data(channel_id, timestamp, value) VALUES (%d, %d, %f)" % (channel_id, timestamp, value)
        resp = cursor.execute(query)
#        print query
        if resp == 1:
syslog.syslog(syslog.LOG_INFO, "Added value (%.2f) to database channel: '%s'" % (value, title))
        else:
raise Exception("Error adding value to database channel:" % title)

        cursor.close()

    def close(self):
        self.Handle.commit()
        self.Handle.close()



Viele Grüße
Sebastian


Am 2013-12-26 11:34, schrieb Daniel Lauckner:
Mahlzeit,

Am Donnerstag, 26. Dezember 2013 um 11:11 schrieb Sebastian Michel:
Hallo,

ich hab folgendes Problem:

[...]

Kann mir jmd weiterhelfen?


Script vergessen?!




mfg Daniel

Antwort per Email an