def checkTrafficTable(self,table):
found = 0
db = MySQLdb.connect("localhost","root","toor", self.VEHICLE_NAME )
# prepare a cursor object using cursor() method
cursor = db.cursor()
try:
# Check if the tags database exists
cursor.execute("SHOW TABLES LIKE '%s';" % table)
results = cursor.fetchall()
for row in results:
if(row[0] == table):
found = 1
# Commit your changes in the database
db.commit()
except:
# Rollback in case there is any error
db.rollback()
db.close()
return(found)
评论列表
文章目录