Changeset 8218c6add in mythtv


Ignore:
Timestamp:
Aug 1, 2004, 1:56:11 AM (20 years ago)
Author:
Bruce Markey <bmarkey@…>
Branches:
devel/2020-player, devel/ffmpeg-resync, devel/gpu-commflag, fixes/0.18, fixes/0.19, fixes/0.20, fixes/0.21, fixes/0.22, fixes/0.23, fixes/0.24, fixes/0.25, fixes/0.26, fixes/0.27, fixes/0.28, fixes/29, fixes/30, fixes/31, github-templates, master
Children:
480b8dbe14
Parents:
5b0601343
Message:

Handle quoting quotes to and from the keyword table. Single and double
quotes work for New Phrase, Delete and Record. Proglist and scheduled
search rules now handle keyword phrases that include quotes.

git-svn-id: http://svn.mythtv.org/svn/trunk@4058 7dbf422c-18fa-0310-86e9-fd20926502f2

Location:
mythtv
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • mythtv/libs/libmythtv/proglist.cpp

    r5b0601343 r8218c6add  
    380380
    381381    QString querystr = NULL;
     382    QString qphrase = NULL;
    382383
    383384    if (newview < 0 || newview != oldview)
     
    385386        if (oldview >= 0)
    386387        {
     388            qphrase = viewList[oldview].utf8();
     389            qphrase.replace("\'", "\\\'");
     390
    387391            querystr = QString("DELETE FROM keyword "
    388392                               "WHERE phrase = '%1' AND searchtype = '%2';")
    389                                .arg(viewList[oldview].utf8()).arg(searchtype);
     393                               .arg(qphrase).arg(searchtype);
    390394            QSqlQuery query;
    391395            query.exec(querystr);
     
    393397        if (newview < 0)
    394398        {
     399            qphrase = text.utf8();
     400            qphrase.replace("\'", "\\\'");
     401
    395402            querystr = QString("REPLACE INTO keyword (phrase, searchtype)"
    396403                               "VALUES('%1','%2');")
    397                                .arg(text.utf8()).arg(searchtype);
     404                               .arg(qphrase).arg(searchtype);
    398405            QSqlQuery query;
    399406            query.exec(querystr);
     
    443450
    444451    QString text = viewList[view];
     452    QString qphrase = text.utf8();
     453    qphrase.replace("\'", "\\\'");
    445454
    446455    QString querystr = QString("DELETE FROM keyword "
    447456                               "WHERE phrase = '%1' AND searchtype = '%2';")
    448                                .arg(text.utf8()).arg(searchtype);
     457                               .arg(qphrase).arg(searchtype);
    449458    QSqlQuery query;
    450459    query.exec(querystr);
     
    744753
    745754    QString where;
     755    QString startstr = startTime.toString("yyyyMMddhhmm50");
     756    QString qphrase = viewList[curView].utf8();
     757    qphrase.replace("\'", "\\\'");
    746758
    747759    if (type == plTitle) // per title listings
     
    749761        where = QString("WHERE channel.visible = 1 "
    750762                        "  AND program.endtime > %1 "
    751                         "  AND program.title = \"%2\" ")
    752                         .arg(startTime.toString("yyyyMMddhhmm50"))
    753                         .arg(viewList[curView].utf8());
     763                        "  AND program.title = '%2' ")
     764                        .arg(startstr).arg(qphrase);
    754765    }
    755766    else if (type == plNewListings) // what's new list
     
    760771                        "  AND program.endtime > %1 "
    761772                        "  AND oldprogram.oldtitle IS NULL "
    762                         "  AND ((program.category_type <> 'movie' "
    763                         "    AND programid NOT LIKE \"MV\%\") "
     773                        "  AND (program.category_type <> 'movie' "
    764774                        "    OR program.airdate >= "
    765775                        "      YEAR(NOW() - INTERVAL 2 YEAR)) "
    766776                        "GROUP BY title ")
    767                         .arg(startTime.toString("yyyyMMddhhmm50"));
     777                        .arg(startstr);
    768778    }
    769779    else if (type == plTitleSearch) // keyword search
     
    771781        where = QString("WHERE channel.visible = 1 "
    772782                        "  AND program.endtime > %1 "
    773                         "  AND program.title LIKE \"\%%2\%\" ")
    774                         .arg(startTime.toString("yyyyMMddhhmm50"))
    775                         .arg(viewList[curView].utf8());
     783                        "  AND program.title LIKE '\%%2\%' ")
     784                        .arg(startstr).arg(qphrase);
    776785    }
    777786    else if (type == plKeywordSearch) // keyword search
     
    779788        where = QString("WHERE channel.visible = 1 "
    780789                        "  AND program.endtime > %1 "
    781                         "  AND (program.title LIKE \"\%%2\%\" "
    782                         "    OR program.subtitle LIKE \"\%%3\%\" "
    783                         "    OR program.description LIKE \"\%%4\%\") ")
    784                         .arg(startTime.toString("yyyyMMddhhmm50"))
    785                         .arg(viewList[curView].utf8())
    786                         .arg(viewList[curView].utf8())
    787                         .arg(viewList[curView].utf8());
     790                        "  AND (program.title LIKE '\%%2\%' "
     791                        "    OR program.subtitle LIKE '\%%3\%' "
     792                        "    OR program.description LIKE '\%%4\%') ")
     793                        .arg(startstr).arg(qphrase).arg(qphrase).arg(qphrase);
     794
    788795    }
    789796    else if (type == plPeopleSearch) // people search
     
    794801                        "WHERE channel.visible = 1 "
    795802                        "  AND program.endtime > %1 "
    796                         "  AND people.name LIKE \"\%%2\%\" ")
    797                         .arg(startTime.toString("yyyyMMddhhmm50"))
    798                         .arg(viewList[curView].utf8());
     803                        "  AND people.name LIKE '\%%2\%' ")
     804                        .arg(startstr).arg(qphrase);
    799805    }
    800806    else if (type == plChannel) // list by channel
     
    802808        where = QString("WHERE channel.visible = 1 "
    803809                        "  AND program.endtime > %1 "
    804                         "  AND channel.chanid = \"%2\" ")
    805                         .arg(startTime.toString("yyyyMMddhhmm50"))
    806                         .arg(viewList[curView]);
     810                        "  AND channel.chanid = '%2' ")
     811                        .arg(startstr).arg(qphrase);
    807812    }
    808813    else if (type == plCategory) // list by category
     
    810815        where = QString("WHERE channel.visible = 1 "
    811816                        "  AND program.endtime > %1 "
    812                         "  AND program.category = \"\%2\" ")
    813                         .arg(startTime.toString("yyyyMMddhhmm50"))
    814                         .arg(viewList[curView].utf8());
     817                        "  AND program.category = '\%2' ")
     818                        .arg(startstr).arg(qphrase);
    815819    }
    816820    else if (type == plMovies) // list movies
     
    818822        where = QString("WHERE channel.visible = 1 "
    819823                        "  AND program.endtime > %1 "
    820                         "  AND (program.category_type = 'movie' "
    821                         "    OR programid LIKE \"MV\%\") ")
    822                         .arg(startTime.toString("yyyyMMddhhmm50"));
     824                        "  AND program.category_type = 'movie' ")
     825                        .arg(startstr);
    823826    }
    824827
  • mythtv/programs/mythbackend/scheduler.cpp

    r5b0601343 r8218c6add  
    12151215    QString query;
    12161216    QSqlQuery result;
     1217    QString qphrase;
    12171218
    12181219    from << "";
     
    12321233    while (result.next())
    12331234    {
     1235    qphrase = result.value(3).toString();
     1236    qphrase.replace("\'", "\\\'");
     1237
    12341238        switch (result.value(1).toInt())
    12351239        {
     
    12391243                .arg(result.value(0).toString())
    12401244                .arg(result.value(2).toString())
    1241                 .arg(result.value(3).toString());
     1245                .arg(qphrase);
    12421246            break;
    12431247        case kTitleSearch:
     
    12461250                             "program.title LIKE '\%%2\%'")
    12471251                .arg(result.value(0).toString())
    1248                 .arg(result.value(3).toString());
     1252                .arg(qphrase);
    12491253            break;
    12501254        case kKeywordSearch:
     
    12551259                             " program.description LIKE '\%%4\%')")
    12561260                .arg(result.value(0).toString())
    1257                 .arg(result.value(3).toString())
    1258                 .arg(result.value(3).toString())
    1259                 .arg(result.value(3).toString());
     1261                .arg(qphrase).arg(qphrase).arg(qphrase);
    12601262            break;
    12611263        case kPeopleSearch:
     
    12671269                             "program.starttime = credits.starttime")
    12681270                .arg(result.value(0).toString())
    1269                 .arg(result.value(3).toString());
     1271                .arg(qphrase);
    12701272            break;
    12711273        default:
Note: See TracChangeset for help on using the changeset viewer.