コード例 #1
0
        public List <RecordedData> GetList(MySqlDbConnection myDbCon)
        {
            List <RecordedData> listData = new List <RecordedData>();

            if (myDbCon == null)
            {
                myDbCon = new MySqlDbConnection();
            }

            string queryString
                = "SELECT r.id "
                  + "    , r.disk_no, r.seq_no, r.rip_status, r.on_air_date "
                  + "    , r.time_flag, r.minute, r.channel_no, r.channel_seq "
                  + "    , p.name, r.detail, r.created_at, r.updated_at "
                  + "  FROM tv.recorded as r LEFT JOIN tv.program as p "
                  + "    ON r.channel_no = p.channel_no and r.channel_seq = p.channel_seq "
                  + "  ORDER BY r.disk_no DESC "
                  + "";

            MySqlDataReader reader = null;

            try
            {
                reader = myDbCon.GetExecuteReader(queryString);

                do
                {
                    if (reader.IsClosed)
                    {
                        //_logger.Debug("reader.IsClosed");
                        throw new Exception("av.storeの取得でreaderがクローズされています");
                    }

                    while (reader.Read())
                    {
                        RecordedData data = new RecordedData();

                        int colIdx = 0;
                        data.Id          = MySqlDbExportCommon.GetDbInt(reader, colIdx++);
                        data.DiskNo      = MySqlDbExportCommon.GetDbString(reader, colIdx++);
                        data.SeqNo       = MySqlDbExportCommon.GetDbString(reader, colIdx++);
                        data.RipStatus   = MySqlDbExportCommon.GetDbString(reader, colIdx++);
                        data.OnAirDate   = MySqlDbExportCommon.GetDbDateTime(reader, colIdx++);
                        data.TimeFlag    = MySqlDbExportCommon.GetDbBool(reader, colIdx++);
                        data.Minute      = MySqlDbExportCommon.GetDbInt(reader, colIdx++);
                        data.ChannelNo   = MySqlDbExportCommon.GetDbInt(reader, colIdx++);
                        data.ChannelSeq  = MySqlDbExportCommon.GetDbInt(reader, colIdx++);
                        data.ProgramName = MySqlDbExportCommon.GetDbString(reader, colIdx++);
                        data.Detail      = MySqlDbExportCommon.GetDbString(reader, colIdx++);
                        data.CreatedAt   = MySqlDbExportCommon.GetDbDateTime(reader, colIdx++);
                        data.UpdatedAt   = MySqlDbExportCommon.GetDbDateTime(reader, colIdx++);

                        listData.Add(data);
                    }
                } while (reader.NextResult());
            }
            catch (Exception ex)
            {
                Debug.Write(ex);
            }
            finally
            {
                reader.Close();
            }

            reader.Close();

            myDbCon.closeConnection();

            return(listData);
        }
コード例 #2
0
        public List <AvContentsData> GetActressLikeFilenameList(string myActress, MySqlDbConnection myDbCon, List <AvContentsData> myExistList)
        {
            List <AvContentsData> avContentsList = new List <AvContentsData>();
            string queryString = "SELECT id, tag, rating FROM av.v_contents WHERE name like @Tag ";

            MySqlDataReader reader = null;

            try
            {
                List <MySqlParameter> listSqlParam = new List <MySqlParameter>();

                MySqlParameter sqlparam = new MySqlParameter("@Tag", MySqlDbType.VarChar);
                sqlparam.Value = String.Format("{0}", myActress);
                listSqlParam.Add(sqlparam);
                myDbCon.SetParameter(listSqlParam.ToArray());

                reader = myDbCon.GetExecuteReader(queryString);

                do
                {
                    myDbCon.SetParameter(listSqlParam.ToArray());

                    if (reader.IsClosed)
                    {
                        //_logger.Debug("av.contents reader.IsClosed");
                        throw new Exception("av.contentsの取得でreaderがクローズされています");
                    }

                    while (reader.Read())
                    {
                        AvContentsData data = new AvContentsData();

                        data.Id     = MySqlDbExportCommon.GetDbInt(reader, 0);
                        data.Tag    = MySqlDbExportCommon.GetDbString(reader, 1);
                        data.Rating = MySqlDbExportCommon.GetDbInt(reader, 2);

                        if (myExistList == null)
                        {
                            avContentsList.Add(data);
                        }
                        else if (!myExistList.Exists(x => x.Id == data.Id))
                        {
                            avContentsList.Add(data);
                        }
                    }
                } while (reader.NextResult());
            }
            catch (Exception ex)
            {
                Debug.Write(ex);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }

            myDbCon.closeConnection();

            return(avContentsList);
        }
コード例 #3
0
        public List <StoreData> GetList(MySqlDbConnection myDbCon)
        {
            List <StoreData> listData = new List <StoreData>();

            if (myDbCon == null)
            {
                myDbCon = new MySqlDbConnection();
            }

            string queryString
                = "SELECT id"
                  + "    , label, name1, name2, type"
                  + "    , path, remark "
                  + "    , created_at, updated_at "
                  + "  FROM av.store "
                  + "";

            MySqlDataReader reader = null;

            try
            {
                reader = myDbCon.GetExecuteReader(queryString);

                do
                {
                    if (reader.IsClosed)
                    {
                        //_logger.Debug("reader.IsClosed");
                        throw new Exception("av.storeの取得でreaderがクローズされています");
                    }

                    while (reader.Read())
                    {
                        StoreData data = new StoreData();

                        data.Id        = MySqlDbExportCommon.GetDbInt(reader, 0);
                        data.Label     = MySqlDbExportCommon.GetDbString(reader, 1);
                        data.Name1     = MySqlDbExportCommon.GetDbString(reader, 2);
                        data.Name2     = MySqlDbExportCommon.GetDbString(reader, 3);
                        data.Type      = MySqlDbExportCommon.GetDbString(reader, 4);
                        data.Path      = MySqlDbExportCommon.GetDbString(reader, 5);
                        data.Remark    = MySqlDbExportCommon.GetDbString(reader, 6);
                        data.CreatedAt = MySqlDbExportCommon.GetDbDateTime(reader, 7);
                        data.UpdatedAt = MySqlDbExportCommon.GetDbDateTime(reader, 8);

                        listData.Add(data);
                    }
                } while (reader.NextResult());
            }
            catch (Exception ex)
            {
                Debug.Write(ex);
            }
            finally
            {
                reader.Close();
            }

            reader.Close();

            myDbCon.closeConnection();

            return(listData);
        }
コード例 #4
0
        public List <ContentsData> GetList(MySqlDbConnection myDbCon)
        {
            List <ContentsData> listData = new List <ContentsData>();

            if (myDbCon == null)
            {
                myDbCon = new MySqlDbConnection();
            }

            string queryString
                = "SELECT f.id"
                  + "    , f.contents_id, f.detail_id, f.store_id, f.label"
                  + "    , f.name, f.source, f.duration, f.time "
                  + "    , f.video_info, f.comment, f.size, f.priority_num  "
                  + "    , f.file_date, f.quality, f.rating1, f.rating2  "
                  + "    , f.remark  "
                  + "    , f.created_at, f.updated_at, d.path "
                  + "  FROM tv.file as f LEFT JOIN tv.real_dir as d "
                  + "    ON f.store_id = d.id  "
                  + "  ORDER BY f.file_date DESC "
                  + "";

            MySqlDataReader reader = null;

            try
            {
                reader = myDbCon.GetExecuteReader(queryString);

                do
                {
                    if (reader.IsClosed)
                    {
                        //_logger.Debug("reader.IsClosed");
                        throw new Exception("av.storeの取得でreaderがクローズされています");
                    }

                    while (reader.Read())
                    {
                        ContentsData data = new ContentsData();

                        int colIdx = 0;
                        data.Id          = MySqlDbExportCommon.GetDbInt(reader, colIdx++);
                        data.ContentsId  = MySqlDbExportCommon.GetDbInt(reader, colIdx++);
                        data.DetailId    = MySqlDbExportCommon.GetDbInt(reader, colIdx++);
                        data.StoreId     = MySqlDbExportCommon.GetDbInt(reader, colIdx++);
                        data.Label       = MySqlDbExportCommon.GetDbString(reader, colIdx++);
                        data.Name        = MySqlDbExportCommon.GetDbString(reader, colIdx++);
                        data.Source      = MySqlDbExportCommon.GetDbString(reader, colIdx++);
                        data.Duration    = MySqlDbExportCommon.GetDbInt(reader, colIdx++);
                        data.Time        = MySqlDbExportCommon.GetDbString(reader, colIdx++);
                        data.VideoInfo   = MySqlDbExportCommon.GetDbString(reader, colIdx++);
                        data.Comment     = MySqlDbExportCommon.GetDbString(reader, colIdx++);
                        data.Size        = MySqlDbExportCommon.GetLong(reader, colIdx++);
                        data.PriorityNum = MySqlDbExportCommon.GetDbInt(reader, colIdx++);
                        data.FileDate    = MySqlDbExportCommon.GetDbDateTime(reader, colIdx++);
                        data.Quality     = MySqlDbExportCommon.GetDbInt(reader, colIdx++);
                        data.Rating1     = MySqlDbExportCommon.GetDbInt(reader, colIdx++);
                        data.Rating2     = MySqlDbExportCommon.GetDbInt(reader, colIdx++);
                        data.Remark      = MySqlDbExportCommon.GetDbString(reader, colIdx++);
                        data.CreatedAt   = MySqlDbExportCommon.GetDbDateTime(reader, colIdx++);
                        data.UpdatedAt   = MySqlDbExportCommon.GetDbDateTime(reader, colIdx++);
                        data.Path        = MySqlDbExportCommon.GetDbString(reader, colIdx++);

                        listData.Add(data);
                    }
                } while (reader.NextResult());
            }
            catch (Exception ex)
            {
                Debug.Write(ex);
            }
            finally
            {
                reader.Close();
            }

            reader.Close();

            myDbCon.closeConnection();

            return(listData);
        }