/// <summary> /// 更新文件状态 /// file_status 0 未操作 /// 1 已操作 2 操作出错 /// </summary> /// <param name="path">路径</param> /// <param name="filetype">类型</param> /// <param name="file_status">状态</param> public static void UpdatefilePath(string path, int filetype, int file_status) { var sql = "update filepath set file_status_id =" + file_status + " ,file_updatetime = '" + DateTime.Now + "' where file_path= '" + path + "' and file_type_id = " + filetype; ISql <SqlCommand, SqlConnection> mysql = new MsSql(); mysql.run(sql, mysql.getUpdate); }
/// <summary> /// 插入错误信息 /// </summary> /// <param name="fileType"></param> /// <param name="URL"></param> public static void InsertSql(int fileType, string URL) { var sql = "insert into errorpath (error_path,error_type,error_CreateTime) values ('" + URL + "','" + fileType + "','" + DateTime.Now + "')"; ISql <SqlCommand, SqlConnection> mysql = new MsSql(); mysql.run(sql, mysql.getInsert); }
/// <summary> /// 从数据库读入list /// type 1 目录 /// 2 文件 /// file_status 0 未操作 和操作失败的 /// 1 已经操作 /// 2 操作失败 /// 其他 其他 /// </summary> /// <param name="type">读取类型</param> /// <param name="fileStatus">读取类型</param> /// <returns></returns> public static List <string> ReadPathByMySql(int type, int fileStatus) { var sql = "select distinct file_path from filepath where file_type_id= " + type + " and file_status_id in ( " + (fileStatus == 0 ? "0,2" : (fileStatus == 1 ? "1" : "0,1,2")) + ")"; ISql <SqlCommand, SqlConnection> mysql = new MsSql(); mysql.run(sql, mysql.getListBysql); return(mysql.pathList); }
/// <summary> /// 插入文件信息 /// </summary> /// <param name="path"></param> /// <param name="innerTxt"></param> /// <param name="fileType"></param> /// <param name="fileStatus"></param> /// <param name="fileParentPath"></param> public static void InsertfilePath(string path, string innerTxt, int fileType, int fileStatus, string fileParentPath) { var sql = "insert into FilePath (file_Path,file_innerTxt,file_Type_id,file_status_id,file_CreateTime,file_parent_path) values ('" + path + "'" + ",'" + innerTxt + "','" + fileType + "','" + fileStatus + "','" + DateTime.Now + "','" + fileParentPath + "')"; ISql <SqlCommand, SqlConnection> mysql = new MsSql(); mysql.run(sql, mysql.getInsert); }