def saveResult(self, robotid, action, degrees=0): db = DatabaseMySQL(host=DB_HOST, user=DB_USER, passwd=DB_PASSWD, db=DB_NAME) db.connect() db.insertCommand(robotid, action, degrees) db.close()
def doStuff(): # get local robot info ldb = DatabaseSQLite(TESTDB) ldb.connect() robotList = ldb.getAllRobots() userList = [] ldb.close() db = DatabaseMySQL(host = HOST, user = USER, passwd = PASSWD, db = DB) db.connect() db.insertAllRobots(robotList) while True: try: doRobotStuff(db, robotList) doUserStuff(db, userList) except Exception as inst: print '-----------------------------------' print inst print '-----------------------------------' time.sleep(5)
def doStuff(): # get local robot info ldb = DatabaseSQLite(TESTDB) ldb.connect() robotList = ldb.getAllRobots() userList = [] ldb.close() db = DatabaseMySQL(host=HOST, user=USER, passwd=PASSWD, db=DB) db.connect() db.insertAllRobots(robotList) while True: try: doRobotStuff(db, robotList) doUserStuff(db, userList) except Exception as inst: print '-----------------------------------' print inst print '-----------------------------------' time.sleep(5)
def saveResult(self, robotid, action, degrees=0): db = DatabaseMySQL(host = DB_HOST, user = DB_USER, passwd = DB_PASSWD, db = DB_NAME) db.connect() db.insertCommand(robotid, action, degrees) db.close()