Ticket #6591: mythtv-6591-check_return_value_of_MSqlQuery_exec-libmythtv.2.patch

File mythtv-6591-check_return_value_of_MSqlQuery_exec-libmythtv.2.patch, 34.8 KB (added by sphery <mtdean@…>, 15 years ago)

mythtv-6591-check_return_value_of_MSqlQuery_exec-libmythtv.patch had one mistake, use this version, instead

  • libs/libmythtv/dbcheck.cpp

    old new  
    10551055        {
    10561056            MSqlQuery query(MSqlQuery::InitCon());
    10571057            query.prepare("UPDATE record SET autocommflag = 1;");
    1058             query.exec();
     1058            if (!query.exec())
     1059                MythDB::DBError("dbcheck -- set autocommflag", query);
    10591060        }
    10601061    }
    10611062    if (dbver == "1057")
     
    15461547                update.prepare(QString(
    15471548                    "UPDATE record SET autotranscode = 1 WHERE recordid = %1;")
    15481549                    .arg(recordids.value(0).toInt()));
    1549                 update.exec();
     1550                if (!update.exec())
     1551                    MythDB::DBError("dbcheck -- set autotranscode", update);
    15501552            }
    15511553        }
    15521554    }
     
    21512153
    21522154                        insert.bindValue(":TYPE", 1);
    21532155                        insert.bindValue(":MARK", start);
    2154                         insert.exec();
     2156                        if (!insert.exec())
     2157                            MythDB::DBError("dbcheck -- recordedmarkup, "
     2158                                            "cut start", insert);
    21552159
    21562160                        insert.bindValue(":TYPE", 0);
    21572161                        insert.bindValue(":MARK", end);
    2158                         insert.exec();
     2162                        if (!insert.exec())
     2163                            MythDB::DBError("dbcheck -- recordedmarkup, "
     2164                                            "cut end", insert);
    21592165                    }
    21602166                }
    21612167            }
     
    25942600                fixup.bindValue(":CHANID", query.value(0).toString());
    25952601                fixup.bindValue(":STARTTIME", query.value(1).toDateTime());
    25962602
    2597                 fixup.exec();
     2603                if (!fixup.exec())
     2604                    MythDB::DBError("dbcheck -- cutlist", fixup);
    25982605            }
    25992606        }
    26002607
     
    26532660            {
    26542661                fixup.bindValue(":DATA", fixupMap[query.value(0).toInt()]);
    26552662                fixup.bindValue(":HOSTNAME", query.value(1).toString());
    2656                 fixup.exec();
     2663                if (!fixup.exec())
     2664                    MythDB::DBError("dbcheck -- DisplayGroupDefaultViewMask",
     2665                                    fixup);
    26572666            }
    26582667        }
    26592668
     
    30093018
    30103019                update.bindValue(":CHANID", airdates.value(0).toString());
    30113020                update.bindValue(":STARTTIME", airdates.value(1).toDateTime());
    3012                 update.exec();
     3021                if (!update.exec())
     3022                    MythDB::DBError("dbcheck -- DisplayGroupDefaultViewMask",
     3023                                    update);
    30133024            }
    30143025        }
    30153026
     
    30703081                         "VALUES('Priority When Shown Once', :VALUE, "
    30713082                         "'program.first > 0 AND program.last > 0');");
    30723083            ppuq.bindValue(":VALUE", oncepriority);
    3073             ppuq.exec();
     3084            if (!ppuq.exec())
     3085                MythDB::DBError("dbcheck -- OnceRecPriority", ppuq);
    30743086        }
    30753087
    30763088        if (ccpriority)
     
    30803092                         "VALUES('Close Captioned Priority', :VALUE, "
    30813093                         "'program.closecaptioned > 0');");
    30823094            ppuq.bindValue(":VALUE", ccpriority);
    3083             ppuq.exec();
     3095            if (!ppuq.exec())
     3096                MythDB::DBError("dbcheck -- CCRecPriority", ppuq);
    30843097        }
    30853098
    30863099        if (!UpdateDBVersionNumber("1186"))
     
    45084521                               "VALUES (:CHANID, :GRPID);");
    45094522                update.bindValue(":CHANID", favorites.value(0).toInt());
    45104523                update.bindValue(":GRPID", 1);
    4511                 update.exec();
     4524                if (!update.exec())
     4525                    MythDB::DBError("dbcheck -- channelgroup", update);
    45124526            }
    45134527        }
    45144528
    45154529        // finally drop the favorites table
    45164530        favorites.prepare("DROP TABLE IF EXISTS favorites;");
    4517         favorites.exec();
     4531        if (!favorites.exec())
     4532            MythDB::DBError("dbcheck -- dropping favorites", favorites);
    45184533    }
    45194534
    45204535    return true;
  • libs/libmythtv/previouslist.cpp

    old new  
    2828#include "mythdbcon.h"
    2929#include "mythverbose.h"
    3030#include "remoteutil.h"
     31#include "mythdb.h"
    3132
    3233PreviousList::PreviousList(MythMainWindow *parent, const char *name,
    3334                         int recid, QString ltitle)
     
    756757        MSqlQuery query(MSqlQuery::InitCon());
    757758        query.prepare("DELETE FROM oldrecorded WHERE title = :TITLE ;");
    758759        query.bindValue(":TITLE", pi->title);
    759         query.exec();
     760        if (!query.exec())
     761            MythDB::DBError("PreviousList -- remove title", query);
    760762
    761763        ScheduledRecording::signalChange(0);
    762764        fillItemList();
     
    779781                  "WHERE chanid = :CHANID AND starttime = :STARTTIME ;");
    780782    query.bindValue(":CHANID", pi->chanid);
    781783    query.bindValue(":STARTTIME", pi->startts.toString(Qt::ISODate));
    782     query.exec();
     784    if (!query.exec())
     785        MythDB::DBError("PreviousList -- delete item", query);
     786
    783787    ScheduledRecording::signalChange(0);
    784788    fillItemList();
    785789}
  • libs/libmythtv/programinfo.cpp

    old new  
    18851885        query.prepare("UPDATE channel SET last_record = NOW() "
    18861886                      "WHERE chanid = :CHANID");
    18871887        query.bindValue(":CHANID", pg->chanid);
    1888         query.exec();
     1888        if (!query.exec())
     1889            MythDB::DBError("insert_program -- channel last_record", query);
    18891890
    18901891        query.prepare("UPDATE record SET last_record = NOW() "
    18911892                      "WHERE recordid = :RECORDID");
    18921893        query.bindValue(":RECORDID", pg->recordid);
    1893         query.exec();
     1894        if (!query.exec())
     1895            MythDB::DBError("insert_program -- record last_record", query);
    18941896
    18951897        if (pg->rectype == kOverrideRecord && pg->parentid > 0)
    18961898        {
    18971899            query.prepare("UPDATE record SET last_record = NOW() "
    18981900                          "WHERE recordid = :PARENTID");
    18991901            query.bindValue(":PARENTID", pg->parentid);
    1900             query.exec();
     1902            if (!query.exec())
     1903                MythDB::DBError("insert_program -- record last_record override",
     1904                                query);
    19011905        }
    19021906    }
    19031907
     
    19201924    query.bindValue(":CHANID", chanid);
    19211925    query.bindValue(":STARTTIME", recstartts);
    19221926
    1923     query.exec();
    1924 
    1925     if (!query.isActive())
     1927    if (!query.exec() || !query.isActive())
    19261928        MythDB::DBError("FinishedRecording update", query);
    19271929
    19281930    GetProgramRecordingStatus();
     
    19451947    query.bindValue(":CHANID", chanid);
    19461948    query.bindValue(":STARTTIME", recstartts);
    19471949
    1948     query.exec();
    1949 
    1950     if (!query.isActive())
    1951         MythDB::DBError("FinishedRecording update", query);
     1950    if (!query.exec() || !query.isActive())
     1951        MythDB::DBError("UpdateRecordingEnd update", query);
    19521952}
    19531953
    19541954
     
    31193119        query.bindValue(":CHANID", chanid);
    31203120        query.bindValue(":STARTTIME", startts);
    31213121
    3122         query.exec();
    3123         if (!query.isActive())
     3122        if (!query.exec() || !query.isActive())
    31243123            MythDB::DBError("UpdateRes", query);
    31253124
    31263125    }
     
    31333132        query.bindValue(":CHANID", chanid);
    31343133        query.bindValue(":STARTTIME", startts);
    31353134
    3136         query.exec();
    3137         if (!query.isActive())
     3135        if (!query.exec() || !query.isActive())
    31383136            MythDB::DBError("UpdateRes", query);
    31393137    }
    31403138    else
     
    31623160    result.bindValue(":TITLE", title);
    31633161    result.bindValue(":STATION", chansign);
    31643162
    3165     result.exec();
    3166     if (!result.isActive())
     3163    if (!result.exec() || !result.isActive())
    31673164        MythDB::DBError("ReactivateRecording", result);
    31683165
    31693166    ScheduledRecording::signalChange(0);
     
    32073204    result.bindValue(":DUPLICATE", dup);
    32083205    result.bindValue(":REACTIVATE", reactivate);
    32093206
    3210     result.exec();
    3211     if (!result.isActive())
     3207    if (!result.exec() || !result.isActive())
    32123208        MythDB::DBError("addHistory", result);
    32133209
    32143210    if (dup && findid)
     
    32183214        result.bindValue(":RECORDID", recordid);
    32193215        result.bindValue(":FINDID", findid);
    32203216
    3221         result.exec();
    3222         if (!result.isActive())
     3217        if (!result.exec() || !result.isActive())
    32233218            MythDB::DBError("addFindHistory", result);
    32243219    }
    32253220
     
    32423237    result.bindValue(":START", recstartts);
    32433238    result.bindValue(":STATION", chansign);
    32443239
    3245     result.exec();
    3246     if (!result.isActive())
     3240    if (!result.exec() || !result.isActive())
    32473241        MythDB::DBError("deleteHistory", result);
    32483242
    32493243    if (/*duplicate &&*/ findid)
     
    32533247        result.bindValue(":RECORDID", recordid);
    32543248        result.bindValue(":FINDID", findid);
    32553249
    3256         result.exec();
    3257         if (!result.isActive())
     3250        if (!result.exec() || !result.isActive())
    32583251            MythDB::DBError("deleteFindHistory", result);
    32593252    }
    32603253
     
    32833276    result.bindValue(":TITLE", title);
    32843277    result.bindValue(":CHANID", chanid);
    32853278
    3286     result.exec();
    3287     if (!result.isActive())
     3279    if (!result.exec() || !result.isActive())
    32883280        MythDB::DBError("forgetRecorded", result);
    32893281
    32903282    result.prepare("UPDATE oldrecorded SET duplicate = 0 "
     
    33003292    result.bindValue(":PROGRAMID", programid);
    33013293    result.bindValue(":FINDID", findid);
    33023294
    3303     result.exec();
    3304     if (!result.isActive())
     3295    if (!result.exec() || !result.isActive())
    33053296        MythDB::DBError("forgetHistory", result);
    33063297
    33073298    result.prepare("DELETE FROM oldrecorded "
    33083299                   "WHERE recstatus = :NEVER AND duplicate = 0");
    33093300    result.bindValue(":NEVER", rsNeverRecord);
    33103301
    3311     result.exec();
    3312     if (!result.isActive())
     3302    if (!result.exec() || !result.isActive())
    33133303        MythDB::DBError("forgetNeverHisttory", result);
    33143304
    33153305    if (findid)
     
    33193309        result.bindValue(":RECORDID", recordid);
    33203310        result.bindValue(":FINDID", findid);
    33213311
    3322         result.exec();
    3323         if (!result.isActive())
     3312        if (!result.exec() || !result.isActive())
    33243313            MythDB::DBError("forgetFindHistory", result);
    33253314    }
    33263315
     
    33493338    result.bindValue(":PROGRAMID", programid);
    33503339    result.bindValue(":FINDID", findid);
    33513340
    3352     result.exec();
    3353     if (!result.isActive())
     3341    if (!result.exec() || !result.isActive())
    33543342        MythDB::DBError("setDupHistory", result);
    33553343
    33563344    ScheduledRecording::signalChange(0);
     
    39733961    query.bindValue(":HOSTNAME", gContext->GetHostName());
    39743962    query.bindValue(":RECUSAGE", inUseForWhat);
    39753963
    3976     query.exec();
     3964    if (!query.exec())
     3965        MythDB::DBError("MarkAsInUse -- delete", query);
    39773966
    39783967    if (!inuse)
    39793968    {
  • libs/libmythtv/jobqueue.cpp

    old new  
    534534    query.bindValue(":STARTTIME", starttime);
    535535    query.bindValue(":JOBTYPE", jobType);
    536536
    537     query.exec();
    538 
    539     if (!query.isActive())
     537    if (!query.exec() || !query.isActive())
    540538    {
    541539        MythDB::DBError("Error in JobQueue::QueueJob()", query);
    542540        return false;
     
    584582    query.bindValue(":COMMENT", comment);
    585583    query.bindValue(":FLAGS", flags);
    586584
    587     query.exec();
    588 
    589     if (!query.isActive())
     585    if (!query.exec() || !query.isActive())
    590586    {
    591587        MythDB::DBError("Error in JobQueue::StartJob()", query);
    592588        return false;
     
    648644    query.bindValue(":STARTTIME", starttime);
    649645    query.bindValue(":JOBTYPE", jobType);
    650646
    651     query.exec();
    652 
    653     if (!query.isActive())
     647    if (!query.exec() || !query.isActive())
    654648    {
    655649        MythDB::DBError("Error in JobQueue::GetJobID()", query);
    656650        return -1;
     
    674668
    675669    query.bindValue(":ID", jobID);
    676670
    677     query.exec();
    678 
    679     if (!query.isActive())
     671    if (!query.exec() || !query.isActive())
    680672    {
    681673        MythDB::DBError("Error in JobQueue::GetJobID()", query);
    682674        return false;
     
    758750    query.bindValue(":STARTTIME", starttime);
    759751    query.bindValue(":QUEUED", JOB_QUEUED);
    760752
    761     query.exec();
    762 
    763     if (!query.isActive())
     753    if (!query.exec() || !query.isActive())
    764754        MythDB::DBError("Cancel Pending Jobs", query);
    765755
    766756    query.prepare("UPDATE jobqueue SET cmds = :CMD "
     
    795785        query.bindValue(":ERRORED", JOB_ERRORED);
    796786        query.bindValue(":CANCELLED", JOB_CANCELLED);
    797787
    798         query.exec();
    799 
    800788        if (!query.exec() || !query.isActive())
    801789        {
    802790            MythDB::DBError("Stop Unfinished Jobs", query);
     
    827815        query.bindValue(":CHANID", chanid);
    828816        query.bindValue(":STARTTIME", starttime);
    829817
    830         query.exec();
    831 
    832         if (!query.isActive())
     818        if (!query.exec() || !query.isActive())
    833819            MythDB::DBError("Delete All Jobs", query);
    834820    }
    835821    else
     
    883869
    884870    query.bindValue(":ID", jobID);
    885871
    886     query.exec();
    887 
    888     if (!query.isActive())
     872    if (!query.exec() || !query.isActive())
    889873    {
    890874        MythDB::DBError("Error in JobQueue::DeleteJob()", query);
    891875        return false;
     
    906890    query.bindValue(":CMDS", newCmds);
    907891    query.bindValue(":ID", jobID);
    908892
    909     query.exec();
    910 
    911     if (!query.isActive())
     893    if (!query.exec() || !query.isActive())
    912894    {
    913895        MythDB::DBError("Error in JobQueue::ChangeJobCmds()", query);
    914896        return false;
     
    930912    query.bindValue(":CHANID", chanid);
    931913    query.bindValue(":STARTTIME", starttime);
    932914
    933     query.exec();
    934 
    935     if (!query.isActive())
     915    if (!query.exec() || !query.isActive())
    936916    {
    937917        MythDB::DBError("Error in JobQueue::ChangeJobCmds()", query);
    938918        return false;
     
    953933    query.bindValue(":FLAGS", newFlags);
    954934    query.bindValue(":ID", jobID);
    955935
    956     query.exec();
    957 
    958     if (!query.isActive())
     936    if (!query.exec() || !query.isActive())
    959937    {
    960938        MythDB::DBError("Error in JobQueue::ChangeJobFlags()", query);
    961939        return false;
     
    981959    query.bindValue(":COMMENT", comment);
    982960    query.bindValue(":ID", jobID);
    983961
    984     query.exec();
    985 
    986     if (!query.isActive())
     962    if (!query.exec() || !query.isActive())
    987963    {
    988964        MythDB::DBError("Error in JobQueue::ChangeJobStatus()", query);
    989965        return false;
     
    1008984    query.bindValue(":COMMENT", comment);
    1009985    query.bindValue(":ID", jobID);
    1010986
    1011     query.exec();
    1012 
    1013     if (!query.isActive())
     987    if (!query.exec() || !query.isActive())
    1014988    {
    1015989        MythDB::DBError("Error in JobQueue::ChangeJobComment()", query);
    1016990        return false;
     
    10321006    query.bindValue(":ARGS", args);
    10331007    query.bindValue(":ID", jobID);
    10341008
    1035     query.exec();
    1036 
    1037     if (!query.isActive())
     1009    if (!query.exec() || !query.isActive())
    10381010    {
    10391011        MythDB::DBError("Error in JobQueue::ChangeJobArgs()", query);
    10401012        return false;
     
    14421414
    14431415    query.bindValue(":ID", jobID);
    14441416
    1445     query.exec();
    1446 
    1447     if (query.isActive())
     1417    if (query.exec() && query.isActive())
    14481418    {
    14491419        if (query.next())
    14501420            return (enum JobCmds)query.value(0).toInt();
     
    14651435
    14661436    query.bindValue(":ID", jobID);
    14671437
    1468     query.exec();
    1469 
    1470     if (query.isActive())
     1438    if (query.exec() && query.isActive())
    14711439    {
    14721440        if (query.next())
    14731441            return query.value(0).toString();
     
    14881456
    14891457    query.bindValue(":ID", jobID);
    14901458
    1491     query.exec();
    1492 
    1493     if (query.isActive())
     1459    if (query.exec() && query.isActive())
    14941460    {
    14951461        if (query.next())
    14961462            return (enum JobFlags)query.value(0).toInt();
     
    15111477
    15121478    query.bindValue(":ID", jobID);
    15131479
    1514     query.exec();
    1515 
    1516     if (query.isActive())
     1480    if (query.exec() && query.isActive())
    15171481    {
    15181482        if (query.next())
    15191483            return (enum JobStatus)query.value(0).toInt();
     
    15371501    query.bindValue(":CHANID", chanid);
    15381502    query.bindValue(":STARTTIME", startts);
    15391503
    1540     query.exec();
    1541 
    1542     if (query.isActive())
     1504    if (query.exec() && query.isActive())
    15431505    {
    15441506        if (query.next())
    15451507            return (enum JobStatus)query.value(0).toInt();
     
    19471909        MSqlQuery query(MSqlQuery::InitCon());
    19481910        query.prepare("SELECT name FROM recordingprofiles WHERE id = :ID;");
    19491911        query.bindValue(":ID", transcoder);
    1950         query.exec();
    1951         if (query.isActive() && query.next())
     1912        if (query.exec() && query.isActive() && query.next())
    19521913        {
    19531914            transcoderName = query.value(0).toString();
    19541915        }
  • libs/libmythtv/livetvchain.cpp

    old new  
    151151                query.bindValue(":START", (*it).starttime);
    152152                query.bindValue(":CHAINID", m_id);
    153153                query.bindValue(":DISCONT", true);
    154                 query.exec();
     154                if (!query.exec())
     155                    MythDB::DBError("LiveTVChain::DeleteProgram -- "
     156                                    "discontinuity", query);
    155157            }
    156158
    157159            query.prepare("DELETE FROM tvchain WHERE chanid = :CHANID "
     
    159161            query.bindValue(":CHANID", (*del).chanid);
    160162            query.bindValue(":START", (*del).starttime);
    161163            query.bindValue(":CHAINID", m_id);
    162             query.exec();
     164            if (!query.exec())
     165                MythDB::DBError("LiveTVChain::DeleteProgram -- delete", query);
    163166
    164167            m_chain.erase(del);
    165168
     
    186189    query.prepare("DELETE FROM tvchain WHERE chainid = :CHAINID ;");
    187190    query.bindValue(":CHAINID", m_id);
    188191
    189     query.exec();
     192    if (!query.exec())
     193        MythDB::DBError("LiveTVChain::DestroyChain", query);
    190194}
    191195
    192196void LiveTVChain::ReloadAll(void)
  • libs/libmythtv/videosource.cpp

    old new  
    731731        "SET userid=NULL, password=NULL "
    732732        "WHERE xmltvgrabber NOT IN ( 'datadirect', 'technovera', "
    733733        "                            'schedulesdirect1' )");
    734     query.exec();
     734    if (!query.exec())
     735        MythDB::DBError("XMLTVConfig::Save", query);
    735736}
    736737
    737738VideoSource::VideoSource()
     
    25312532        MSqlQuery query(MSqlQuery::InitCon());
    25322533        query.prepare("DELETE FROM cardinput WHERE cardinputid = :INPUTID");
    25332534        query.bindValue(":INPUTID", getInputID());
    2534         query.exec();
     2535        if (!query.exec())
     2536            MythDB::DBError("CardInput::Save", query);
    25352537    }
    25362538    else
    25372539    {
  • libs/libmythtv/scheduledrecording.cpp

    old new  
    536536    MSqlQuery query(MSqlQuery::InitCon());
    537537    querystr = QString("DELETE FROM record WHERE recordid = %1").arg(rid);
    538538    query.prepare(querystr);
    539     query.exec();
     539    if (!query.exec())
     540        MythDB::DBError("ScheduledRecording::remove -- record", query);
    540541
    541542    querystr = QString("DELETE FROM oldfind WHERE recordid = %1").arg(rid);
    542543    query.prepare(querystr);
    543     query.exec();
     544    if (!query.exec())
     545        MythDB::DBError("ScheduledRecording::remove -- oldfind", query);
    544546}
    545547
    546548void ScheduledRecording::signalChange(int recordid)
     
    10351037        thequery = QString("SELECT MAX(recordid) FROM %1 ORDER BY recordid;")
    10361038                           .arg(ttable);
    10371039        query.prepare(thequery);
    1038         query.exec();
    1039         if (query.isActive() && query.next())
     1040        if (query.exec() && query.isActive() && query.next())
    10401041            id->setValue(query.value(0).toInt() + 1);
    10411042        else
    10421043            id->setValue(100000);
  • libs/libmythtv/playgroup.cpp

    old new  
    186186    query.bindValue(":TITLE1", pi->title);
    187187    query.bindValue(":TITLE2", pi->title);
    188188    query.bindValue(":CATEGORY", pi->category);
    189     query.exec();
    190189
    191190    if (!query.exec())
    192191        MythDB::DBError("GetInitialName", query);
  • libs/libmythtv/channelgroup.cpp

    old new  
    5353        query.prepare(
    5454            QString("DELETE FROM channelgroup "
    5555                    "WHERE id = '%1'").arg(id));
    56         query.exec();
     56        if (!query.exec())
     57            MythDB::DBError("ChannelGroup::ToggleChannel -- delete", query);
    5758        VERBOSE(VB_IMPORTANT, LOC + QString("Removing channel with id=%1.").arg(id));
    5859    }
    5960    else if (query.size() == 0)
     
    6263        query.prepare(
    6364            QString("INSERT INTO channelgroup (chanid,grpid) "
    6465                    "VALUES ('%1','%2')").arg(chanid).arg(changrpid));
    65         query.exec();
     66        if (!query.exec())
     67            MythDB::DBError("ChannelGroup::ToggleChannel -- insert", query);
    6668        VERBOSE(VB_IMPORTANT, LOC + QString("Adding channel %1 to group %2.").arg(chanid).arg(changrpid));
    6769    }
    6870
     
    8486
    8587    if (!query.exec() || !query.isActive())
    8688    {
    87         MythDB::DBError("ChannelGroup::ToggleChannel", query);
     89        MythDB::DBError("ChannelGroup::AddChannel", query);
    8890        return false;
    8991    }
    9092    else if (query.size() == 0)
     
    9395        query.prepare(
    9496            QString("INSERT INTO channelgroup (chanid,grpid) "
    9597                    "VALUES ('%1','%2')").arg(chanid).arg(changrpid));
    96         query.exec();
     98        if (!query.exec())
     99            MythDB::DBError("ChannelGroup::AddChannel -- insert", query);
    97100        VERBOSE(VB_IMPORTANT, LOC + QString("Adding channel %1 to group %2.").arg(chanid).arg(changrpid));
    98101    }
    99102
     
    115118
    116119    if (!query.exec() || !query.isActive())
    117120    {
    118         MythDB::DBError("ChannelGroup::ToggleChannel", query);
     121        MythDB::DBError("ChannelGroup::DeleteChannel", query);
    119122        return false;
    120123    }
    121124    else if (query.size() > 0)
     
    126129        query.prepare(
    127130            QString("DELETE FROM channelgroup "
    128131                    "WHERE id = '%1'").arg(id));
    129         query.exec();
     132        if (!query.exec())
     133            MythDB::DBError("ChannelGroup::DeleteChannel -- delete", query);
    130134        VERBOSE(VB_IMPORTANT, LOC + QString("Removing channel with id=%1.").arg(id));
    131135    }
    132136
  • libs/libmythtv/proglist_qt.cpp

    old new  
    2727#include "mythdbcon.h"
    2828#include "mythverbose.h"
    2929#include "channelutil.h"
     30#include "mythdb.h"
    3031
    3132ProgListerQt::ProgListerQt(ProgListTypeQt pltype,
    3233                       const QString &view, const QString &from,
     
    495496                          "WHERE phrase = :PHRASE AND searchtype = :TYPE;");
    496497            query.bindValue(":PHRASE", qphrase);
    497498            query.bindValue(":TYPE", searchtype);
    498             query.exec();
     499            if (!query.exec())
     500                MythDB::DBError("ProgListerQt::updateKeywordInDB -- delete",
     501                                query);
    499502        }
    500503        if (newview < 0)
    501504        {
     
    506509                          "VALUES(:PHRASE, :TYPE );");
    507510            query.bindValue(":PHRASE", qphrase);
    508511            query.bindValue(":TYPE", searchtype);
    509             query.exec();
     512            if (!query.exec())
     513                MythDB::DBError("ProgListerQt::updateKeywordInDB -- replace",
     514                                query);
    510515        }
    511516    }
    512517}
     
    644649                  "WHERE phrase = :PHRASE AND searchtype = :TYPE;");
    645650    query.bindValue(":PHRASE", qphrase);
    646651    query.bindValue(":TYPE", searchtype);
    647     query.exec();
     652    if (!query.exec())
     653        MythDB::DBError("ProgListerQt::deleteKeyword", query);
    648654
    649655    chooseListBox->removeRow(view + 1);
    650656    viewList.removeAll(text);
     
    985991    MSqlQuery query(MSqlQuery::InitCon());
    986992
    987993    query.prepare("SELECT genre FROM programgenres GROUP BY genre;");
    988     query.exec();
    989994
    990     if (query.isActive() && query.size())
     995    if (query.exec() && query.isActive())
    991996    {
    992997        while (query.next())
    993998        {
     
    12621267                      "WHERE program.endtime > :PGILSTART "
    12631268                      "GROUP BY g1.genre, g2.genre;");
    12641269        query.bindValue(":PGILSTART", startstr);
    1265         query.exec();
    12661270
    1267         if (query.isActive() && query.size())
     1271        if (query.exec() && query.isActive() && query.size())
    12681272        {
    12691273            QString lastGenre1;
    12701274
     
    12981302                          "WHERE program.endtime > :PGILSTART "
    12991303                          "GROUP BY category;");
    13001304            query.bindValue(":PGILSTART", startstr);
    1301             query.exec();
    13021305
    1303             if (query.isActive() && query.size())
     1306            if (query.exec() && query.isActive())
    13041307            {
    13051308                while (query.next())
    13061309                {
     
    13261329        query.prepare("SELECT phrase FROM keyword "
    13271330                      "WHERE searchtype = :SEARCHTYPE;");
    13281331        query.bindValue(":SEARCHTYPE", searchtype);
    1329         query.exec();
    13301332
    1331         if (query.isActive() && query.size())
     1333        if (query.exec() && query.isActive())
    13321334        {
    13331335            while (query.next())
    13341336            {
     
    13531355                              "VALUES(:VIEW, :SEARCHTYPE );");
    13541356                query.bindValue(":VIEW", qphrase);
    13551357                query.bindValue(":SEARCHTYPE", searchtype);
    1356                 query.exec();
     1358                if (!query.exec())
     1359                    MythDB::DBError("ProgListerQt::fillViewList -- replace",
     1360                                    query);
    13571361
    13581362                viewList << qphrase;
    13591363                viewTextList << qphrase;
     
    14511455        query.prepare("SELECT title FROM record "
    14521456                      "WHERE recordid = :RECORDID");
    14531457        query.bindValue(":RECORDID", view);
    1454         query.exec();
    14551458
    1456         if (query.isActive() && query.size())
     1459        if (query.exec() && query.isActive())
    14571460        {
    14581461            if (query.next())
    14591462            {
     
    14691472        MSqlQuery query(MSqlQuery::InitCon());
    14701473        query.prepare("SELECT rulename FROM customexample "
    14711474                      "WHERE search > 0 ORDER BY rulename;");
    1472         query.exec();
    14731475
    1474         if (query.isActive() && query.size())
     1476        if (query.exec() && query.isActive())
    14751477        {
    14761478            while (query.next())
    14771479            {
     
    17191721        query.prepare("SELECT fromclause, whereclause FROM customexample "
    17201722                      "WHERE rulename = :RULENAME;");
    17211723        query.bindValue(":RULENAME", qphrase);
    1722         query.exec();
    17231724
    1724         if (query.isActive() && query.size())
     1725        if (query.exec() && query.isActive() && query.next())
    17251726        {
    1726             query.next();
    17271727            fromc  = query.value(0).toString();
    17281728            wherec = query.value(1).toString();
    17291729
  • libs/libmythtv/profilegroup.cpp

    old new  
    214214                                   "(name, profilegroup) VALUES (:NAME, :PROFID);");
    215215                    result.bindValue(":NAME", availProfiles[i]);
    216216                    result.bindValue(":PROFID", profileID);
    217                     result.exec();
     217                    if (!result.exec())
     218                        MythDB::DBError("ProfileGroup::getHostNames", result);
    218219                }
    219220            }
    220221        }
     
    305306                            "codecparams.profile = recordingprofiles.id "
    306307                            "AND recordingprofiles.profilegroup = %1").arg(id);
    307308            result.prepare(querystr);
    308             result.exec();
     309            if (!result.exec())
     310                MythDB::DBError("ProfileGroupEditor::callDelete -- "
     311                                "delete codecparams", result);
    309312
    310313            querystr = QString("DELETE FROM recordingprofiles WHERE "
    311314                            "profilegroup = %1").arg(id);
    312315            result.prepare(querystr);
    313             result.exec();
     316            if (!result.exec())
     317                MythDB::DBError("ProfileGroupEditor::callDelete -- "
     318                                "delete recordingprofiles", result);
    314319
    315320            querystr = QString("DELETE FROM profilegroups WHERE id = %1;").arg(id);
    316321            result.prepare(querystr);
    317             result.exec();
     322            if (!result.exec())
     323                MythDB::DBError("ProfileGroupEditor::callDelete -- "
     324                                "delete profilegroups", result);
    318325
    319326            redraw = true;
    320327
  • libs/libmythtv/programdata.cpp

    old new  
    3636
    3737    query.prepare("SELECT tmoffset FROM channel where chanid = :CHANID ;");
    3838    query.bindValue(":CHANID", chanid);
    39     query.exec();
    40     if (!query.isActive() || query.size() != 1)
     39    if (!query.exec() || !query.isActive() || query.size() != 1)
    4140    {
    4241        MythDB::DBError("clearDataByChannel", query);
    4342        return;
     
    5554    query.bindValue(":FROM", newFrom);
    5655    query.bindValue(":TO", newTo);
    5756    query.bindValue(":CHANID", chanid);
    58     query.exec();
     57    if (!query.exec())
     58        MythDB::DBError("ProgramData::clearDataByChannel -- delete program",
     59                        query);
    5960
    6061    query.prepare("DELETE FROM programrating "
    6162                  "WHERE starttime >= :FROM AND starttime < :TO "
     
    6364    query.bindValue(":FROM", newFrom);
    6465    query.bindValue(":TO", newTo);
    6566    query.bindValue(":CHANID", chanid);
    66     query.exec();
     67    if (!query.exec())
     68        MythDB::DBError("ProgramData::clearDataByChannel -- "
     69                        "delete programrating", query);
    6770
    6871    query.prepare("DELETE FROM credits "
    6972                  "WHERE starttime >= :FROM AND starttime < :TO "
     
    7174    query.bindValue(":FROM", newFrom);
    7275    query.bindValue(":TO", newTo);
    7376    query.bindValue(":CHANID", chanid);
    74     query.exec();
     77    if (!query.exec())
     78        MythDB::DBError("ProgramData::clearDataByChannel -- delete credits",
     79                        query);
    7580
    7681    query.prepare("DELETE FROM programgenres "
    7782                  "WHERE starttime >= :FROM AND starttime < :TO "
     
    7984    query.bindValue(":FROM", newFrom);
    8085    query.bindValue(":TO", newTo);
    8186    query.bindValue(":CHANID", chanid);
    82     query.exec();
     87    if (!query.exec())
     88        MythDB::DBError("ProgramData::clearDataByChannel -- "
     89                        "delete programgenres", query);
    8390}
    8491
    8592void ProgramData::clearDataBySource(int sourceid, QDateTime from, QDateTime to)
     
    203210        chanQuery.bindValue(":ID", id);
    204211        chanQuery.bindValue(":XMLTVID", mapiter.key());
    205212
    206         chanQuery.exec();
    207 
    208         if (!chanQuery.isActive() || chanQuery.size() <= 0)
     213        if (!chanQuery.exec() || !chanQuery.isActive() || chanQuery.size() <= 0)
    209214        {
    210215            VERBOSE(VB_IMPORTANT, QString("Unknown xmltv channel identifier: "
    211216                                          "%1 - Skipping channel.")
     
    275280                query.bindValue(":COLORCODE", (*i).colorcode);
    276281                query.bindValue(":SYNDICATEDEPISODENUMBER", (*i).syndicatedepisodenumber);
    277282                query.bindValue(":PROGRAMID", (*i).programid);
    278                 query.exec();
    279283
    280                 if (query.isActive() && query.size() > 0)
     284                if (query.exec() && query.isActive() && query.size() > 0)
    281285                {
    282286                    unchanged++;
    283287                    continue;
     
    289293                query.bindValue(":CHANID", chanid);
    290294                query.bindValue(":START", (*i).start);
    291295                query.bindValue(":END", (*i).end);
    292                 query.exec();
    293296
    294                 if (query.isActive() && query.size() > 0)
     297                if (query.exec() && query.isActive() && query.size() > 0)
    295298                {
    296299
    297300                    while (query.next())
     
    319322                    subquery.bindValue(":START", (*i).start);
    320323                    subquery.bindValue(":END", (*i).end);
    321324
    322                     subquery.exec();
     325                    if (!subquery.exec())
     326                        MythDB::DBError("ProgramData::handlePrograms -- "
     327                                        "delete program", subquery);
    323328
    324329                    subquery.prepare("DELETE FROM programrating WHERE "
    325330                                     "chanid=:CHANID AND starttime>=:START "
     
    328333                    subquery.bindValue(":START", (*i).start);
    329334                    subquery.bindValue(":END", (*i).end);
    330335
    331                     subquery.exec();
     336                    if (!subquery.exec())
     337                        MythDB::DBError("ProgramData::handlePrograms -- "
     338                                        "delete programrating", subquery);
    332339
    333340                    subquery.prepare("DELETE FROM credits WHERE "
    334341                                     "chanid=:CHANID AND starttime>=:START "
     
    337344                    subquery.bindValue(":START", (*i).start);
    338345                    subquery.bindValue(":END", (*i).end);
    339346
    340                     subquery.exec();
     347                    if (!subquery.exec())
     348                        MythDB::DBError("ProgramData::handlePrograms -- "
     349                                        "delete credits", subquery);
    341350                }
    342351
    343352                query.prepare("INSERT INTO program (chanid,starttime,endtime,"