public List <MovieImportData> GetList(MySqlDbConnection myDbCon) { List <MovieImportData> listData = new List <MovieImportData>(); MySqlDbConnection dbcon; string sqlcmd = ""; // 引数にコネクションが指定されていた場合は指定されたコネクションを使用 if (myDbCon != null) { dbcon = myDbCon; } else { dbcon = new MySqlDbConnection(); } sqlcmd = "SELECT ID, copy_text, KIND, MATCH_PRODUCT, PRODUCT_NUMBER, sell_date, MAKER, TITLE, ACTRESSES, RAR_FLAG, SPLIT_FLAG, NAME_ONLY_FLAG, TAG, FILENAME, CREATED_AT, UPDATED_AT, HD_KIND, movie_file_id, RATING, JAV_POST_DATE, SIZE, PACKAGE, THUMBNAIL, DOWNLOAD_FILES, SEARCH_RESULT, DETAIL, jav_id, is_target, jav_url "; sqlcmd = sqlcmd + "FROM import "; sqlcmd = sqlcmd + "ORDER BY JAV_POST_DATE "; MySqlDataReader reader = null; try { reader = dbcon.GetExecuteReader(sqlcmd); do { if (reader.IsClosed) { //_logger.Debug("reader.IsClosed"); throw new Exception("MOVIE_SITESTOREの取得でreaderがクローズされています"); } while (reader.Read()) { MovieImportData data = new MovieImportData(); data.Id = MysqlExportCommon.GetDbInt(reader, 0); data.CopyText = MysqlExportCommon.GetDbString(reader, 1); data.Kind = MysqlExportCommon.GetDbInt(reader, 2); data.MatchProduct = MysqlExportCommon.GetDbString(reader, 3); data.ProductNumber = MysqlExportCommon.GetDbString(reader, 4); data.ProductDate = MysqlExportCommon.GetDbDateTime(reader, 5); data.StrMaker = MysqlExportCommon.GetDbString(reader, 6); data.Title = MysqlExportCommon.GetDbString(reader, 7); data.Actresses = MysqlExportCommon.GetDbString(reader, 8); data.RarFlag = Convert.ToBoolean(MysqlExportCommon.GetDbInt(reader, 9)); data.SplitFlag = Convert.ToBoolean(MysqlExportCommon.GetDbInt(reader, 10)); data.NameOnlyFlag = Convert.ToBoolean(MysqlExportCommon.GetDbInt(reader, 11)); data.Tag = MysqlExportCommon.GetDbString(reader, 12); data.Filename = MysqlExportCommon.GetDbString(reader, 13); data.CreateDate = MysqlExportCommon.GetDbDateTime(reader, 14); data.UpdateDate = MysqlExportCommon.GetDbDateTime(reader, 15); data.SetHdKind(MysqlExportCommon.GetDbInt(reader, 16)); data.FileId = MysqlExportCommon.GetDbInt(reader, 17); data.Rating = MysqlExportCommon.GetDbInt(reader, 18); data.JavPostDate = MysqlExportCommon.GetDbDateTime(reader, 19); data.Size = MysqlExportCommon.GetDbLong(reader, 20); data.Package = MysqlExportCommon.GetDbString(reader, 21); data.Thumbnail = MysqlExportCommon.GetDbString(reader, 22); data.DownloadFiles = MysqlExportCommon.GetDbString(reader, 23); data.SearchResult = MysqlExportCommon.GetDbString(reader, 24); data.Detail = MysqlExportCommon.GetDbString(reader, 25); data.JavId = MysqlExportCommon.GetDbLong(reader, 26); data.IsTarget = MysqlExportCommon.GetDbBool(reader, 27); data.JavUrl = MysqlExportCommon.GetDbString(reader, 28); listData.Add(data); } } while (reader.NextResult()); } finally { reader.Close(); } myDbCon.closeConnection(); return(listData); }
public MakerData GetById(long myId, MySqlDbConnection myDbCon) { MakerData data = new MakerData(); MySqlDbConnection dbcon; string sqlcmd = ""; // 引数にコネクションが指定されていた場合は指定されたコネクションを使用 if (myDbCon != null) { dbcon = myDbCon; } else { dbcon = new MySqlDbConnection(); } sqlcmd = "SELECT id, name, match_name, label, match_label, kind, match_str, match_product_number, site_kind, replace_words, p_number_gen, info_url, deleted, registered_by, created_at, updated_at "; sqlcmd = sqlcmd + "FROM maker WHERE id = " + myId + " "; sqlcmd = sqlcmd + "ORDER BY CREATED_AT DESC"; MySqlDataReader reader = null; try { reader = myDbCon.GetExecuteReader(sqlcmd); if (reader.IsClosed) { //_logger.Debug("reader.IsClosed"); throw new Exception("MOVIE_SITESTOREの取得でreaderがクローズされています"); } if (reader.Read()) { data.Id = MysqlExportCommon.GetDbInt(reader, 0); data.Name = MysqlExportCommon.GetDbString(reader, 1); data.MatchName = MysqlExportCommon.GetDbString(reader, 2); data.Label = MysqlExportCommon.GetDbString(reader, 3); data.MatchLabel = MysqlExportCommon.GetDbString(reader, 4); data.Kind = MysqlExportCommon.GetDbInt(reader, 5); data.MatchStr = MysqlExportCommon.GetDbString(reader, 6); data.MatchProductNumber = MysqlExportCommon.GetDbString(reader, 7); data.SiteKind = MysqlExportCommon.GetDbInt(reader, 8); data.ReplaceWord = MysqlExportCommon.GetDbString(reader, 9); data.ProductNumberGenerate = MysqlExportCommon.GetDbInt(reader, 10); data.InformationUrl = MysqlExportCommon.GetDbString(reader, 11); data.Deleted = MysqlExportCommon.GetDbInt(reader, 12); data.RegisteredBy = MysqlExportCommon.GetDbString(reader, 13); data.CreatedAt = MysqlExportCommon.GetDbDateTime(reader, 14); data.UpdatedAt = MysqlExportCommon.GetDbDateTime(reader, 15); } } finally { reader.Close(); } reader.Close(); myDbCon.closeConnection(); return(data); }
public MovieImportData GetNewest(MySqlDbConnection myDbCon) { MovieImportData newestData = new MovieImportData(); MySqlDbConnection dbcon; string sqlcmd = ""; // 引数にコネクションが指定されていた場合は指定されたコネクションを使用 if (myDbCon != null) { dbcon = myDbCon; } else { dbcon = new MySqlDbConnection(); } sqlcmd = "SELECT ID, COPY_TEXT, KIND, MATCH_PRODUCT, PRODUCT_NUMBER, SELL_DATE, MAKER, TITLE, ACTRESSES, RAR_FLAG, SPLIT_FLAG, NAME_ONLY_FLAG, TAG, FILENAME, RATING, JAV_POST_DATE, PACKAGE, THUMBNAIL, DOWNLOAD_FILES, jav_id, is_target, CREATED_AT, UPDATED_AT "; sqlcmd = sqlcmd + "FROM import "; sqlcmd = sqlcmd + "ORDER BY CREATED_AT DESC"; MySqlDataReader reader = null; try { reader = myDbCon.GetExecuteReader(sqlcmd); if (reader.IsClosed) { //_logger.Debug("reader.IsClosed"); throw new Exception("MOVIE_SITESTOREの取得でreaderがクローズされています"); } if (reader.Read()) { newestData.Id = MysqlExportCommon.GetDbInt(reader, 0); newestData.CopyText = MysqlExportCommon.GetDbString(reader, 1); newestData.Kind = MysqlExportCommon.GetDbInt(reader, 2); newestData.MatchProduct = MysqlExportCommon.GetDbString(reader, 3); newestData.ProductNumber = MysqlExportCommon.GetDbString(reader, 4); newestData.ProductDate = MysqlExportCommon.GetDbDateTime(reader, 5); newestData.StrMaker = MysqlExportCommon.GetDbString(reader, 6); newestData.Title = MysqlExportCommon.GetDbString(reader, 7); newestData.Actresses = MysqlExportCommon.GetDbString(reader, 8); newestData.RarFlag = Convert.ToBoolean(MysqlExportCommon.GetDbInt(reader, 9)); newestData.SplitFlag = Convert.ToBoolean(MysqlExportCommon.GetDbInt(reader, 10)); newestData.NameOnlyFlag = Convert.ToBoolean(MysqlExportCommon.GetDbInt(reader, 11)); newestData.Tag = MysqlExportCommon.GetDbString(reader, 12); newestData.Filename = MysqlExportCommon.GetDbString(reader, 13); newestData.Rating = MysqlExportCommon.GetDbInt(reader, 14); newestData.JavPostDate = MysqlExportCommon.GetDbDateTime(reader, 15); newestData.Package = MysqlExportCommon.GetDbString(reader, 16); newestData.Thumbnail = MysqlExportCommon.GetDbString(reader, 17); newestData.DownloadFiles = MysqlExportCommon.GetDbString(reader, 18); newestData.JavId = MysqlExportCommon.GetDbLong(reader, 19); newestData.IsTarget = MysqlExportCommon.GetDbBool(reader, 20); newestData.CreateDate = MysqlExportCommon.GetDbDateTime(reader, 21); newestData.UpdateDate = MysqlExportCommon.GetDbDateTime(reader, 22); } } finally { reader.Close(); } reader.Close(); myDbCon.closeConnection(); return(newestData); }
public List <ReplaceInfoData> GetTypeAll(ReplaceInfoData.EnumType myType, MySqlDbConnection myDbCon) { List <ReplaceInfoData> list = new List <ReplaceInfoData>(); MySqlDbConnection dbcon; string sqlcmd = ""; // 引数にコネクションが指定されていた場合は指定されたコネクションを使用 if (myDbCon != null) { dbcon = myDbCon; } else { dbcon = new MySqlDbConnection(); } sqlcmd = "SELECT id, type, source, destination, source_type, created_at, updated_at "; sqlcmd = sqlcmd + "FROM replace_info "; sqlcmd = sqlcmd + "WHERE type = @Type "; sqlcmd = sqlcmd + "ORDER BY created_at DESC"; List <MySqlParameter> listSqlParams = new List <MySqlParameter>(); MySqlCommand command = new MySqlCommand(sqlcmd, dbcon.getMySqlConnection()); MySqlParameter sqlparam = new MySqlParameter("@Type", MySqlDbType.Enum); sqlparam.Value = myType; listSqlParams.Add(sqlparam); dbcon.SetParameter(listSqlParams.ToArray()); MySqlDataReader reader = null; try { reader = myDbCon.GetExecuteReader(sqlcmd); if (reader.IsClosed) { //_logger.Debug("reader.IsClosed"); throw new Exception("replace_infoの取得でreaderがクローズされています"); } while (reader.Read()) { ReplaceInfoData data = new ReplaceInfoData(); data.Id = MysqlExportCommon.GetDbInt(reader, 0); data.Type = GetEnumType(reader, 1); data.Source = MysqlExportCommon.GetDbString(reader, 2); data.Destination = MysqlExportCommon.GetDbString(reader, 3); data.SourceType = GetEnumSourceType(reader, 4); data.CreatedAt = MysqlExportCommon.GetDbDateTime(reader, 5); data.UpdatedAt = MysqlExportCommon.GetDbDateTime(reader, 6); list.Add(data); } } finally { reader.Close(); } reader.Close(); myDbCon.closeConnection(); return(list); }