Ticket #3842: 3842-add-new-column-trunk-v2.patch

File 3842-add-new-column-trunk-v2.patch, 7.9 KB (added by danielk, 17 years ago)

Updates add "isnew" column patch to current trunk revision

  • libs/libmythtv/dbcheck.cpp

     
    1111#include "datadirect.h" // for DataDirectProcessor::FixProgramIDs
    1212
    1313/// This is the DB schema version expected by the running MythTV instance.
    14 const QString currentDatabaseVersion = "1199";
     14const QString currentDatabaseVersion = "1200";
    1515
    1616static bool UpdateDBVersionNumber(const QString &newnumber);
    1717static bool performActualUpdate(const QString updates[], QString version,
     
    294294airing. If this is "0" it usually means that this is a brand new show
    295295or a rebroadcast within the first two weeks.
    296296
     297'isnew' is a field that tells us if a listings source has marked this
     298program as a first showing of a program.
     299
    297300'programid' is the Tribune Media Service database record identifier
    298301for each program description. In general, these start with a two
    299302letter prefix, MV, EP, SP or SH that equate to the 'category_type'.
     
    32473250            return false;
    32483251    }
    32493252
     3253    if (dbver == "1199")
     3254    {
     3255        const QString updates[] = {
     3256"ALTER TABLE recorded        ADD COLUMN isnew TINYINT(1) DEFAULT 0;",
     3257"ALTER TABLE recordedprogram ADD COLUMN isnew TINYINT(1) DEFAULT 0;",
     3258"ALTER TABLE program         ADD COLUMN isnew TINYINT(1) DEFAULT 0;",
     3259"ALTER TABLE program         ADD INDEX (isnew);",
     3260""
     3261};
     3262        if (!performActualUpdate(updates, "1200", dbver))
     3263            return false;
     3264    }
     3265
    32503266//"ALTER TABLE cardinput DROP COLUMN preference;" in 0.22
    32513267//"ALTER TABLE channel DROP COLUMN atscsrcid;" in 0.22
    32523268//"ALTER TABLE recordedmarkup DROP COLUMN offset;" in 0.22
  • libs/libmythtv/datadirect.h

     
    9797    QString   stationid; // 12
    9898    QDateTime time;
    9999    QTime     duration;
    100     bool      repeat;
    101100    bool      isnew;
    102101    bool      stereo;
    103102    bool      subtitled;
  • libs/libmythtv/datadirect.cpp

     
    6868DataDirectSchedule::DataDirectSchedule() :
    6969    programid(""),              stationid(""),
    7070    time(QDateTime()),          duration(QTime()),
    71     repeat(false),              isnew(false),
     71    isnew(false),
    7272    stereo(false),              subtitled(false),
    7373    hdtv(false),                closecaptioned(false),
    7474    tvrating(""),
     
    168168        curr_schedule.duration = QTime(durstr.mid(2, 2).toInt(),
    169169                                       durstr.mid(5, 2).toInt(), 0, 0);
    170170
    171         curr_schedule.repeat = (pxmlatts.value("repeat") == "true");
    172171        curr_schedule.isnew = (pxmlatts.value("new") == "true");
    173172        curr_schedule.stereo = (pxmlatts.value("stereo") == "true");
    174173        curr_schedule.subtitled = (pxmlatts.value("subtitled") == "true");
     
    277276        query.prepare(
    278277            "INSERT INTO dd_schedule "
    279278            "     ( programid,  stationid,   scheduletime,   "
    280             "       duration,   isrepeat,    stereo,         "
     279            "       duration,   isnew,       stereo,         "
    281280            "       subtitled,  hdtv,        closecaptioned, "
    282281            "       tvrating,   partnumber,  parttotal,      "
    283             "       endtime,    isnew) "
     282            "       endtime ) "
    284283            "VALUES "
    285284            "     (:PROGRAMID, :STATIONID,  :TIME,           "
    286             "      :DURATION,  :ISREPEAT,   :STEREO,         "
     285            "      :DURATION,  :ISNEW,      :STEREO,         "
    287286            "      :SUBTITLED, :HDTV,       :CAPTIONED,      "
    288287            "      :TVRATING,  :PARTNUMBER, :PARTTOTAL,      "
    289             "      :ENDTIME,   :ISNEW)");
     288            "      :ENDTIME )");
    290289
    291290        query.bindValue(":PROGRAMID",   curr_schedule.programid);
    292291        query.bindValue(":STATIONID",   curr_schedule.stationid);
    293292        query.bindValue(":TIME",        curr_schedule.time);
    294293        query.bindValue(":DURATION",    curr_schedule.duration);
    295         query.bindValue(":ISREPEAT",    curr_schedule.repeat);
    296294        query.bindValue(":STEREO",      curr_schedule.stereo);
    297295        query.bindValue(":SUBTITLED",   curr_schedule.subtitled);
    298296        query.bindValue(":HDTV",        curr_schedule.hdtv);
     
    608606        "INSERT INTO dd_v_program "
    609607        "     ( chanid,         starttime,       endtime,         "
    610608        "       title,          subtitle,        description,     "
    611         "       airdate,        stars,           previouslyshown, "
     609        "       airdate,        stars,           isnew, "
    612610        "       stereo,         subtitled,       hdtv,            "
    613611        "       closecaptioned, partnumber,      parttotal,       "
    614612        "       seriesid,       originalairdate, showtype,        "
     
    616614        "       tvrating,       mpaarating,      programid )      "
    617615        "SELECT chanid,         scheduletime,    endtime,         "
    618616        "       title,          subtitle,        description,     "
    619         "       year,           stars,           isrepeat,        "
     617        "       year,           stars,           isnew,           "
    620618        "       stereo,         subtitled,       hdtv,            "
    621619        "       closecaptioned, partnumber,      parttotal,       "
    622620        "       seriesid,       originalairdate, showtype,        "
     
    804802    if (!query.exec("INSERT IGNORE INTO program (chanid, starttime, endtime, "
    805803                    "title, subtitle, description, "
    806804                    "showtype, category, category_type, "
    807                     "airdate, stars, previouslyshown, stereo, subtitled, "
     805                    "airdate, stars, isnew, stereo, subtitled, "
    808806                    "hdtv, closecaptioned, partnumber, parttotal, seriesid, "
    809807                    "originalairdate, colorcode, syndicatedepisodenumber, "
    810808                    "programid) "
     
    813811                    "DATE_ADD(endtime, INTERVAL channel.tmoffset MINUTE), "
    814812                    "title, subtitle, description, "
    815813                    "showtype, dd_genre.class, category_type, "
    816                     "airdate, stars, previouslyshown, stereo, subtitled, "
     814                    "airdate, stars, isnew, stereo, subtitled, "
    817815                    "hdtv, closecaptioned, partnumber, parttotal, seriesid, "
    818816                    "originalairdate, colorcode, syndicatedepisodenumber, "
    819817                    "dd_v_program.programid FROM (dd_v_program, channel) "
     
    12971295    dd_tables["dd_schedule"] =
    12981296        "( programid char(40),           stationid char(12), "
    12991297        "  scheduletime datetime,        duration time,      "
    1300         "  isrepeat bool,                stereo bool,        "
     1298        "  isnew tinyint,                stereo bool,        "
    13011299        "  subtitled bool,               hdtv bool,          "
    13021300        "  closecaptioned bool,          tvrating char(5),   "
    13031301        "  partnumber int,               parttotal int,      "
    1304         "  endtime datetime,             isnew bool,         "
     1302        "  endtime datetime, "
    13051303        "INDEX progidx (programid) )";
    13061304
    13071305    dd_tables["dd_program"] =
     
    13211319        "  subtitle varchar(128),        description text,            "
    13221320        "  category varchar(64),         category_type varchar(64),   "
    13231321        "  airdate year,                 stars float unsigned,        "
    1324         "  previouslyshown tinyint,      isrepeat bool,               "
     1322        "  isnew tinyint,                                             "
    13251323        "  stereo bool,                  subtitled bool,              "
    13261324        "  hdtv bool,                    closecaptioned bool,         "
    13271325        "  partnumber int,               parttotal int,               "