def prepare_data(self, host, user, password, db, sql): """数据准备,添加测试数据""" mysql.connect(host, user, password, db) res = mysql.execute(sql) mysql.close() logging.info("Run sql: the row number affected is %s", res) return res
def prepare_data(self, host, user, password, db, sql): """ 数据准备,添加测试数据 :param host: 服务地址 :param user: 用户 :param password: 密码 :param db: 数据库名 :param sql: 执行的SQL :return: """ mysql.connect(host, user, password, db) res = mysql.execute(sql) mysql.close() logging.info("Run sql: the row number affected is %s" % res) return res