import pymysql

class Tool:
    id = 0
    name = ""
    typeid = 0

    def __init__(self, id, typeid):
        self.id = id
        self.typeid = typeid


def get_tool_name(id):
        conn=pymysql.connect(host = '192.168.31.9' # 连接名称，默认
        ,user = 'saipo'
        ,passwd='Grasste0403' # 密码
        ,port= 3306 # 端口，默认为3306
        ,db='saipo' # 数据库名称
        ,charset='utf8' # 字符编码
        )
        cur = conn.cursor()
        sql = "SELECT name FROM dajiaotool WHERE id = %s"
        cur.execute(sql, (id,))
        result = cur.fetchone()
        cur.close()
        conn.close()
        if result:
            return result[0]
        else:
            return None    
