def playback(self, table):
if(self.VEHICLE_NAME == ""):
self.TextArea.insert(END, "Please register/log in to a vehicle.\n")
return
# Open database connection
db = MySQLdb.connect("localhost","root","toor",self.VEHICLE_NAME )
# prepare a cursor object using cursor() method
cursor = db.cursor()
sql = "SELECT * FROM %s ;" % table
count = 0
try:
# Execute the SQL command
cursor.execute(sql)
# Update the Treeview
# Fetch all the rows in a list of lists.
results = cursor.fetchall()
for row in results:
cmd = "cansend %s %s#%s.%s%s.%s%s%s%s.%s" % (q.get(), row[1], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10])
for line in execute([cmd]):
count = count + 1
# Commit your changes in the database
db.commit()
except:
# Rollback in case there is any error
db.rollback()
评论列表
文章目录