Ticket #3061: patch.r12767.2.diff

File patch.r12767.2.diff, 45.2 KB (added by luitjens, 17 years ago)

updated to r12767 and replaced a few .size() calls with .numRowsAffected(). usleep does this work for you?

  • channeleditor.cpp

     
    5454                  " AND cardinput.cardid = capturecard.cardid");
    5555    query.bindValue(":CHID", cid->getValue());
    5656
    57     if (query.exec() && query.isActive() && query.size() > 0)
     57    if (query.exec() && query.isActive() && query.next())
    5858    {
    59         query.next();
    6059        return query.value(0).toString();
    6160    }
    6261    else
     
    7675    query.bindValue(":CHID", cid->getValue());
    7776    query.bindValue(":CARDTYPE", thecardtype);
    7877
    79     if (query.exec() && query.isActive() && query.size() > 0)
     78    if (query.exec() && query.isActive() && query.next())
    8079    {
    81         query.next();
    8280        int count = query.value(0).toInt();
    8381
    8482        if (count > 0)
     
    9896        " AND cardinput.cardid = capturecard.cardid");
    9997    query.bindValue(":CHID", cid->getValue());
    10098
    101     if (query.exec() && query.isActive() && query.size() > 0)
     99    if (query.exec() && query.isActive() && query.next())
    102100    {
    103         query.next();
    104101        return query.value(0).toInt();
    105102    } else
    106103        return 0;
     
    141138    MSqlQuery query(MSqlQuery::InitCon());
    142139    query.prepare(querystr);
    143140   
    144     if (query.exec() && query.isActive() && query.size() > 0)
     141    if (query.exec())
    145142    {
    146143        while(query.next())
    147144        {
     
    198195        MSqlQuery query(MSqlQuery::InitCon());
    199196        query.prepare("SELECT name, sourceid FROM videosource");
    200197
    201         if (query.exec() && query.isActive() && query.size() > 0)
     198        if (query.exec())
    202199        {
    203200            while(query.next())
    204201            {
  • sr_items.cpp

     
    224224    query.prepare("SELECT cardinputid,cardid,inputname,displayname "
    225225                  "FROM cardinput ORDER BY cardinputid");
    226226
    227     if (query.exec() && query.isActive() && query.size() > 0)
     227    if (query.exec())
    228228    {
    229229        while (query.next())
    230230        {
  • jobqueue.cpp

     
    533533    }
    534534    else
    535535    {
    536         if ((query.size() > 0) && query.next())
     536        if (query.next())
    537537        {
    538538            tmpStatus = query.value(0).toInt();
    539539            jobID = query.value(1).toInt();
     
    633633    }
    634634    else
    635635    {
    636         if ((query.size() > 0) && query.next())
     636        if (query.next())
    637637            return query.value(0).toInt();
    638638    }
    639639
     
    659659    }
    660660    else
    661661    {
    662         if ((query.size() > 0) && query.next())
     662        if (query.next())
    663663        {
    664664            jobType = query.value(0).toInt();
    665665            chanid = query.value(1).toString();
     
    779779            return false;
    780780        }
    781781
    782         if (query.size() == 0)
     782        if (!query.next())
    783783        {
    784784            jobsAreRunning = false;
    785785            break;
     
    12971297
    12981298    if (query.isActive())
    12991299    {
    1300         if ((query.size() > 0) && query.next())
     1300        if (query.next())
    13011301            return (enum JobCmds)query.value(0).toInt();
    13021302    }
    13031303    else
     
    13431343
    13441344    if (query.isActive())
    13451345    {
    1346         if ((query.size() > 0) && query.next())
     1346        if (query.next())
    13471347            return (enum JobFlags)query.value(0).toInt();
    13481348    }
    13491349    else
     
    13661366
    13671367    if (query.isActive())
    13681368    {
    1369         if ((query.size() > 0) && query.next())
     1369        if (query.next())
    13701370            return (enum JobStatus)query.value(0).toInt();
    13711371    }
    13721372    else
     
    13921392
    13931393    if (query.isActive())
    13941394    {
    1395         if (query.size() > 0 && query.next())
     1395        if (query.next())
    13961396            return (enum JobStatus)query.value(0).toInt();
    13971397    }
    13981398    else
     
    17721772        query.prepare("SELECT name FROM recordingprofiles WHERE id = :ID;");
    17731773        query.bindValue(":ID", transcoder);
    17741774        query.exec();
    1775         if (query.isActive() && query.size() > 0 && query.next())
     1775        if (query.isActive() && query.next())
    17761776        {
    17771777            transcoderName = query.value(0).toString();
    17781778        }
  • proglist.cpp

     
    973973    query.prepare("SELECT genre FROM programgenres GROUP BY genre;");
    974974    query.exec();
    975975
    976     if (query.isActive() && query.size())
     976    if (query.isActive())
    977977    {
    978978        while (query.next())
    979979        {
     
    12461246        query.prepare("SELECT category FROM program GROUP BY category;");
    12471247        query.exec();
    12481248
    1249         if (query.isActive() && query.size())
     1249        if (query.isActive())
    12501250        {
    12511251            while (query.next())
    12521252            {
     
    12701270        query.bindValue(":SEARCHTYPE", searchtype);
    12711271        query.exec();
    12721272
    1273         if (query.isActive() && query.size())
     1273        if (query.isActive())
    12741274        {
    12751275            while (query.next())
    12761276            {
     
    13711371        query.bindValue(":RECORDID", view);
    13721372        query.exec();
    13731373
    1374         if (query.isActive() && query.size())
     1374        if (query.isActive())
    13751375        {
    13761376            if (query.next())
    13771377            {
  • dbcheck.cpp

     
    14841484            "    AND c.profile = p.id"
    14851485            "    AND r.profile = p.name"
    14861486            ";");
    1487         if (recordids.exec() && recordids.isActive() && recordids.size() > 0)
     1487        if (recordids.exec() && recordids.isActive() )
    14881488        {
    14891489            MSqlQuery update(MSqlQuery::InitCon());
    14901490            while (recordids.next())
     
    16231623        if (!recordids.exec())
    16241624            return false;
    16251625
    1626         if (recordids.isActive() && recordids.size() > 0)
     1626        if (recordids.isActive())
    16271627        {
    16281628            MSqlQuery update(MSqlQuery::InitCon());
    16291629            while (recordids.next())
     
    20702070        MSqlQuery query(MSqlQuery::InitCon());
    20712071        query.prepare("SELECT chanid, starttime, cutlist FROM recorded"
    20722072                      " WHERE LENGTH(cutlist) > 1;");
    2073         if (query.exec() && query.isActive() && query.size() > 0)
     2073        if (query.exec() && query.isActive())
    20742074        {
    20752075            MSqlQuery insert(MSqlQuery::InitCon());
    20762076            while (query.next())
     
    25262526        MSqlQuery query(MSqlQuery::InitCon());
    25272527        query.prepare("SELECT DISTINCT chanid, starttime FROM recordedmarkup "
    25282528                      "WHERE type = 1;");
    2529         if (query.exec() && query.isActive() && query.size() > 0)
     2529        if (query.exec() && query.isActive())
    25302530        {
    25312531            MSqlQuery fixup(MSqlQuery::InitCon());
    25322532            while (query.next())
     
    25842584
    25852585        query.prepare("SELECT data, hostname FROM settings "
    25862586                          "WHERE value = 'DisplayGroupDefaultView'");
    2587         if (query.exec() && query.isActive() && query.size() > 0)
     2587        if (query.exec() && query.isActive())
    25882588        {
    25892589            MSqlQuery fixup(MSqlQuery::InitCon());
    25902590
     
    29262926    query.prepare("SHOW TABLES;");
    29272927
    29282928    // check for > 1 table here since the schemalock table should exist
    2929     if (query.exec() && query.isActive() && query.size() > 1)
     2929    if (query.exec() && query.isActive() && query.next() && query.next())
    29302930    {
     2931        int qsize = 2;
     2932        while(query.next())
     2933            qsize++;
    29312934        QString msg = QString(
    29322935            "Told to create a NEW database schema, but the database\n"
    29332936            "already has %1 tables.\n"
    29342937            "If you are sure this is a good mythtv database, verify\n"
    29352938            "that the settings table has the DBSchemaVer variable.\n")
    2936             .arg(query.size() - 1);
     2939            .arg(qsize - 1);
    29372940        VERBOSE(VB_IMPORTANT, msg);
    29382941        return false;
    29392942    }
  • livetvchain.cpp

     
    200200                  "WHERE chainid = :CHAINID ORDER BY chainpos;");
    201201    query.bindValue(":CHAINID", m_id);
    202202
    203     if (query.exec() && query.isActive() && query.size() > 0)
     203    if (query.exec())
    204204    {
    205205        while (query.next())
    206206        {
  • siscan.cpp

     
    238238        return false;
    239239    }
    240240
    241     if (query.size() <= 0)
     241    if (!query.next())
    242242    {
    243243        VERBOSE(VB_SIPARSER, LOC + "Unable to find any transports for " +
    244244                QString("sourceid %1").arg(sourceID));
     
    246246        return false;
    247247    }
    248248
    249     while (query.next())
     249    do
    250250    {
    251251        int sourceid = query.value(0).toInt();
    252252        int mplexid  = query.value(1).toInt();
     
    260260
    261261        TransportScanItem item(sourceid, std, fn, mplexid, signalTimeout);
    262262        scanTransports += item;
    263     }
     263    } while(query.next());
    264264
    265265    waitingForTables  = false;
    266266    transportsScanned = 0;
     
    957957        return false;
    958958    }
    959959
    960     if (query.size() <= 0)
     960    if (!query.next())
    961961    {
    962962        VERBOSE(VB_SIPARSER, LOC + "Unable to find transport to scan.");
    963963        return false;
    964964    }
    965965
    966     while (query.next())
     966    do
    967967    {
    968968        int sourceid = query.value(0).toInt();
    969969        int mplexid  = query.value(1).toInt();
     
    977977
    978978        TransportScanItem item(sourceid, std, fn, mplexid, signalTimeout);
    979979        scanTransports += item;
    980     }
     980    } while(query.next());
    981981
    982982    timer.start();
    983983    waitingForTables  = false;
  • channelbase.cpp

     
    357357        return -1;
    358358    }
    359359
    360     if (query.size() <= 0)
     360    if (!query.next())
    361361        return -1;
    362362
    363     query.next();
    364363    return query.value(0).toInt();
    365364}
    366365
     
    394393        MythContext::DBError("InitializeInputs", query);
    395394        return false;
    396395    }
    397     else if (!query.size())
     396    else if (!query.next())
    398397    {
    399398        VERBOSE(VB_IMPORTANT, LOC_ERR + "InitializeInputs(): "
    400399                "\n\t\t\tCould not get inputs for the capturecard."
     
    405404
    406405    allchannels.clear();
    407406    QString order = gContext->GetSetting("ChannelOrdering", "channum");
    408     while (query.next())
     407    do
    409408    {
    410409        // If there is a childcardid use it instead of cardid
    411410        uint inputcardid = query.value(6).toUInt();
     
    424423        allchannels.insert(allchannels.end(),
    425424                           channels.begin(), channels.end());
    426425    }
     426    while (query.next());
     427
    427428    ChannelUtil::SortChannels(allchannels, order);
    428429    ChannelUtil::EliminateDuplicateChanNum(allchannels);
    429430
     
    527528    {
    528529        MythContext::DBError("checkchannel", query);
    529530    }
    530     else if (query.size() > 0)
     531    else if (query.next())
    531532    {
    532533        return true;
    533534    }
     
    554555    {
    555556        MythContext::DBError("checkchannel", query);
    556557    }
    557     else if (query.size() > 0)
     558    else if (query.next())
    558559    {
    559         query.next();
    560560        QString test = query.value(1).toString();
    561561        if (test != QString::null)
    562562            inputName = QString::fromUtf8(test);
     
    574574
    575575    query.prepare("SELECT NULL FROM channel");
    576576
    577     if (query.exec() && query.size() == 0)
     577    if (query.exec() && !query.next())
    578578        ret = true;
    579579
    580580    return ret;
  • datadirect.cpp

     
    683683    if (!dd_station_info.exec())
    684684        return false;
    685685
    686     if (dd_station_info.size() == 0)
     686    if (!dd_station_info.next())
    687687        return true;
    688688
    689689    MSqlQuery chan_update_q(MSqlQuery::DDCon());
     
    695695        "    atsc_minor_chan = :MINORCHAN "
    696696        "WHERE xmltvid = :STATIONID AND sourceid = :SOURCEID");
    697697
    698     while (dd_station_info.next())       
     698    do
    699699    {
    700700        uint    freqid     = dd_station_info.value(3).toUInt();
    701701        QString chan_major = dd_station_info.value(4).toString();
     
    719719                                 chan_update_q.lastQuery());
    720720        }
    721721    }
     722    while (dd_station_info.next());
    722723
    723724    return true;
    724725}
  • channelutil.cpp

     
    511511            QString("GetBetterMplexID(mplexId %1, tId %2, netId %3)")
    512512            .arg(current_mplexid).arg(transport_id).arg(network_id));
    513513
    514     int q_networkid = 0, q_transportid = 0;
     514    int q_networkid = 0, q_transportid = 0, qsize = 0;
    515515    MSqlQuery query(MSqlQuery::InitCon());
    516516
    517517    query.prepare(QString("SELECT networkid, transportid "
     
    520520
    521521    if (!query.exec() || !query.isActive())
    522522        MythContext::DBError("Getting mplexid global search", query);
    523     else if (query.size())
     523    else if (query.next())
    524524    {
    525         query.next();
    526525        q_networkid   = query.value(0).toInt();
    527526        q_transportid = query.value(1).toInt();
     527        qsize = 1;
    528528    }
    529529
    530530    // Got a match, return it.
     
    539539    // Not in DB at all, insert it
    540540    if (!q_networkid && !q_transportid)
    541541    {
    542         int qsize = query.size();
     542        while(query.next())
     543            qsize++;
     544
    543545        query.prepare(QString("UPDATE dtv_multiplex "
    544546                              "SET networkid = %1, transportid = %2 "
    545547                              "WHERE mplexid = %3")
     
    580582        if (!query.exec() || !query.isActive())
    581583            MythContext::DBError("Finding matching mplexid", query);
    582584
    583         if (query.size() == 1)
     585        qsize = 0;
     586        if (query.next())
    584587        {
    585             VERBOSE(VB_SIPARSER, QString(
     588            qsize = 1;
     589            if(!query.next())
     590            {
     591                VERBOSE(VB_SIPARSER, QString(
    586592                        "GetBetterMplexID(): query#%1 qsize(%2) "
    587593                        "Returning %3")
    588                     .arg(i).arg(query.size()).arg(current_mplexid));
    589             query.next();
    590             return query.value(0).toInt();
     594                        .arg(i).arg(qsize).arg(current_mplexid));
     595
     596                return query.value(0).toInt();
     597            }
    591598        }
    592599
    593         if (query.size() > 1)
     600        if (qsize == 1)
    594601        {
    595             query.next();
    596602            int ret = (i==0) ? current_mplexid : query.value(0).toInt();
     603            while (query.next())
     604                qsize++;
    597605            VERBOSE(VB_SIPARSER, QString(
    598                         "GetBetterMplexID(): query#%1 qsize(%2) "
    599                         "Returning %3")
    600                     .arg(i).arg(query.size()).arg(ret));
     606                    "GetBetterMplexID(): query#%1 qsize(%2) "
     607                    "Returning %3")
     608                    .arg(i).arg(qsize).arg(ret));
    601609            return ret;
    602610        }
    603611    }
     
    655663        MythContext::DBError("Selecting channel/dtv_multiplex 1", query);
    656664        return QString::null;
    657665    }
    658     if (!query.size())
     666    if (!query.next())
    659667        return QString::null;
    660668
    661     query.next();
    662669    return query.value(0).toString();
    663670}
    664671
     
    691698        return -1;
    692699    }
    693700
    694     if (query.size() > 0)
     701    if (query.next())
    695702    {
    696         query.next();
    697703        return query.value(0).toInt();
    698704    }
    699705    return -1;
     
    859865                  "FROM dtv_multiplex "
    860866                  "WHERE mplexid = :MPLEXID");
    861867    query.bindValue(":MPLEXID", mplexid);
    862     if (!query.exec() || !query.isActive() || !query.size())
     868    if (!query.exec() || !query.isActive() || !query.next())
    863869    {
    864870        MythContext::DBError("Selecting channel/dtv_multiplex 2", query);
    865871        return -1;
    866872    }
    867     if (!query.next())
    868         return -1;
    869873
    870874    int source_id = query.value(0).toInt();
    871875
     
    973977
    974978    if (!query.exec() || !query.isActive())
    975979        MythContext::DBError("is_chan_id_available", query);
    976     else if (query.size() == 0)
     980    else if (!query.next())
    977981        return true;
    978982
    979983    return false;
     
    12001204        return false;
    12011205    }
    12021206
    1203     if (query.size() > 0)
     1207    if (query.next())
    12041208    {
    1205         query.next();
    12061209        return query.value(0).toInt();
    12071210    }
    12081211    return -1;
  • programdata.cpp

     
    3737    query.prepare("SELECT tmoffset FROM channel where chanid = :CHANID ;");
    3838    query.bindValue(":CHANID", chanid);
    3939    query.exec();
    40     if (!query.isActive() || query.size() != 1)
     40    if (!query.isActive() || !query.next())
    4141    {
    4242        MythContext::DBError("clearDataByChannel", query);
    4343        return;
    4444    }
    45     query.next();
    4645    secs = query.value(0).toInt();
    4746
    4847    secs *= 60;
     
    9291    if (!query.exec())
    9392        MythContext::DBError("Selecting channels per source", query);
    9493       
    95     if (query.isActive() && query.size() > 0)
     94    if (query.isActive() )
    9695    {
    9796        while (query.next())
    9897        {
     
    159158    findq.bindValue(":FINDONE", kFindOneRecord);
    160159    findq.exec();
    161160       
    162     if (findq.isActive() && findq.size() > 0)
     161    if (findq.isActive() )
    163162    {
    164163        while (findq.next())
    165164        {
     
    281280
    282281        chanQuery.exec();
    283282
    284         if (!chanQuery.isActive() || chanQuery.size() <= 0)
     283        if (!chanQuery.isActive() || !chanQuery.next())
    285284        {
    286285            cerr << "Unknown xmltv channel identifier: " << mapiter.key()
    287286                 << endl << "Skipping channel.\n";
    288287            continue;
    289288        }
    290289
    291         while (chanQuery.next())
     290        do
    292291        {
    293292            chanid = chanQuery.value(0).toInt();
    294293
     
    351350                query.bindValue(":PROGRAMID", (*i).programid);
    352351                query.exec();
    353352
    354                 if (query.isActive() && query.size() > 0)
     353                if (query.isActive() && query.next())
    355354                {
    356355                    unchanged++;
    357356                    continue;
     
    365364                query.bindValue(":END", (*i).end);
    366365                query.exec();
    367366
    368                 if (query.isActive() && query.size() > 0)
     367                if (query.isActive() && query.next())
    369368                {
    370369                    if (!quiet)
    371370                    {
    372                         while (query.next())
     371                        do
    373372                        {
    374373                            cerr << "removing existing program: "
    375374                                 << query.value(1).toDateTime().toString(Qt::ISODate) << " - "
     
    377376                                 << (*i).channel.local8Bit() << " "
    378377                                 << QString::fromUtf8(query.value(0).toString()).local8Bit()  << endl;
    379378                        }
     379                        while (query.next());
    380380
    381381                        cerr << "inserting new program    : "
    382382                             << (*i).start.toString(Qt::ISODate) << " - "
     
    482482                        MythContext::DBError("person lookup", query);
    483483
    484484                    int personid = -1;
    485                     if (query.isActive() && query.size() > 0)
     485                    if (query.isActive() && query.next())
    486486                    {
    487                         query.next();
    488487                        personid = query.value(0).toInt();
    489488                    }
    490489
     
    502501                        if (!query.exec())
    503502                            MythContext::DBError("person lookup", query);
    504503
    505                         if (query.isActive() && query.size() > 0)
     504                        if (query.isActive() && query.next())
    506505                        {
    507                             query.next();
    508506                            personid = query.value(0).toInt();
    509507                        }
    510508                    }
     
    542540                }
    543541            }
    544542        }
     543        while(chanQuery.next());
    545544    }
     545
    546546    if (!quiet)
    547547    {
    548548        cerr << "Updated programs: " << updated
  • tv_play.cpp

     
    809809                          "hostname = :HOSTNAME ;");
    810810            query.bindValue(":HOSTNAME", gContext->GetHostName());
    811811
    812             if (query.exec() && query.isActive() && query.size() > 0)
     812            if (query.exec() && query.next())
    813813            {
    814                 query.next();
    815 
    816814                QKeySequence keyseq(query.value(0).toString());
    817815
    818816                int keynum = keyseq[0];
     
    43884386        query.prepare("SELECT channum FROM channel "
    43894387                      "WHERE chanid = :CHANID");
    43904388        query.bindValue(":CHANID", chanid);
    4391         if (query.exec() && query.isActive() && query.size() > 0 && query.next())
     4389        if (query.exec() && query.next())
    43924390            channum = query.value(0).toString();
    43934391        else
    43944392            channum = QString::number(chanid);
     
    47074705                  "      cardid    = :CARDID");
    47084706    query.bindValue(":CARDID",    cardid);
    47094707    query.bindValue(":INPUTNAME", inputname);
    4710     if (query.exec() && query.isActive() && query.next())
     4708    if (query.exec() && query.next())
    47114709        displayName = query.value(0).toString();
    47124710
    47134711    // If a display name doesn't exist use cardid and inputname
  • dvbchannel.cpp

     
    771771        return -1;
    772772    }
    773773
    774     if (query.size() <= 0)
     774    if (!query.next())
    775775        return -1;
    776776
    777     query.next();
    778777    return query.value(0).toInt();
    779778}
    780779
  • cardutil.cpp

     
    3434    query.bindValue(":CARDTYPE", strType);
    3535    query.bindValue(":HOSTNAME", gContext->GetHostName());
    3636
    37     if (query.exec() && query.isActive() && query.size() > 0)
     37    if (query.exec() && query.isActive() && query.next())
    3838    {
    39         query.next();
    4039        int count = query.value(0).toInt();
    4140
    4241        if (count > 0)
  • storagegroup.cpp

     
    4949
    5050    if (!query.exec() || !query.isActive())
    5151        MythContext::DBError("StorageGroup::StorageGroup()", query);
    52     else if (query.size() < 1)
     52    else if (!query.next() )
    5353    {
    5454        if (group != "Default")
    5555        {
     
    7171    }
    7272    else
    7373    {
    74         while(query.next())
     74        do
    7575        {
    7676            m_dirname = query.value(0).toString();
    7777            m_dirname.replace(QRegExp("^\\s*"), "");
     
    7979            if (m_dirname.right(1) == "/")
    8080                m_dirname.remove(m_dirname.length() - 1, 1);
    8181            m_dirlist << m_dirname;
    82         }
     82        } while(query.next());
    8383    }
    8484
    8585    if (!m_dirlist.size())
  • videosource.cpp

     
    8787    query.prepare(querystr);
    8888    query.bindValue(":HOSTNAME", gContext->GetHostName());
    8989
    90     if (!query.exec() || !query.isActive() || query.size() <= 0)
     90    if (!query.exec() || !query.isActive() )
    9191        return;
    9292
    9393    uint sel = 0, cnt = 0;
     
    9898
    9999        sel = (query.value(1).toUInt() == initial_sourceid) ? cnt : sel;
    100100    }
     101    if(cnt==0)
     102        return;
    101103
    102104    if (initial_sourceid)
    103105    {
     
    581583    query.bindValue(":SOURCEID", sourceID);
    582584    query.bindValue(":CARDTYPE", thecardtype);
    583585
    584     if (query.exec() && query.isActive() && query.size() > 0)
     586    if (query.exec() && query.isActive() && query.next())
    585587    {
    586         query.next();
    587588        int count = query.value(0).toInt();
    588589
    589590        if (count > 0)
     
    598599    MSqlQuery result(MSqlQuery::InitCon());
    599600    result.prepare("SELECT name, sourceid FROM videosource;");
    600601
    601     if (result.exec() && result.isActive() && result.size() > 0)
     602    if (result.exec() && result.isActive())
    602603    {
    603604        while (result.next())
    604605        {
     
    14251426        MythContext::DBError("CaptureCard::fillSelections", query);
    14261427        return;
    14271428    }
    1428     if (query.size() == 0)
    1429         return;
    14301429
    14311430    while (query.next())
    14321431    {
     
    23142313        "      parentid = '0'");
    23152314    query.bindValue(":HOSTNAME", gContext->GetHostName());
    23162315
    2317     if (!query.exec() || !query.isActive() || !query.size())
     2316    if (!query.exec() || !query.isActive())
    23182317        return;
    23192318
    23202319    uint j = 0;
  • channelsettings.cpp

     
    415415        MythContext::DBError("sourceChanged -- supports eit", query);
    416416    else
    417417    {
    418         supports_eit = (query.size()) ? false : true;
    419         while (query.next())
     418        supports_eit = (query.next()) ? false : true;
     419        do
    420420        {
    421421            supports_eit |= CardUtil::IsEITCapable(
    422422                query.value(0).toString().upper());
    423423        }
     424        while (query.next());
    424425
    425426        query.prepare("SELECT xmltvgrabber "
    426427                      "FROM videosource "
     
    431432            MythContext::DBError("sourceChanged -- eit only", query);
    432433        else
    433434        {
    434             uses_eit_only = (query.size()) ? true : false;
    435             while (query.next())
     435            uses_eit_only = (query.next()) ? true : false;
     436            do
    436437            {
    437438                uses_eit_only &= (query.value(0).toString() == "eitonly");
    438439            }
     440            while (query.next());
    439441        }
    440442    }
    441443
  • videoout_xv.cpp

     
    77#include <ctime>
    88#include <cerrno>
    99
    10 #include <malloc.h>
     10#include <stdlib.h>
    1111#include <fcntl.h>
    1212#include <unistd.h>
    1313#include <sys/time.h>
  • profilegroup.cpp

     
    7474
    7575    result.prepare("SELECT DISTINCT cardtype FROM capturecard;");
    7676
    77     if (result.exec() && result.isActive() && result.size() > 0)
     77    if (result.exec() && result.isActive() )
    7878    {
    7979        while (result.next())
    8080        {
     
    8585    result.prepare("SELECT name,id,hostname,is_default,cardtype "
    8686                      "FROM profilegroups;");
    8787
    88     if (result.exec() && result.isActive() && result.size() > 0)
     88    if (result.exec() && result.isActive())
    8989        while (result.next())
    9090        {
    9191            // Only show default profiles that match installed cards
     
    118118                            .arg(group);
    119119    result.prepare(querystr);
    120120
    121     if (result.exec() && result.isActive() && result.size() > 0)
     121    if (result.exec() && result.isActive() && result.next())
    122122    {
    123         result.next();
    124123        return QString::fromUtf8(result.value(0).toString());
    125124    }
    126125
     
    135134                            .arg(getName()).arg(host->getValue());
    136135    result.prepare(querystr);
    137136
    138     if (result.exec() && result.isActive() && result.size() > 0)
     137    if (result.exec() && result.isActive() && result.next())
    139138        return false;
    140139    return true;
    141140}
     
    148147
    149148    result.prepare("SELECT DISTINCT hostname from capturecard");
    150149
    151     if (result.exec() && result.isActive() && result.size() > 0)
     150    if (result.exec() && result.isActive() )
    152151    {
    153152        while (result.next())
    154153            hostnames->append(result.value(0).toString());
     
    193192                                    "profilegroup = %1").arg(profileID);
    194193            result.prepare(querystr);
    195194
    196             if (result.exec() && result.isActive() && result.size() > 0)
     195            if (result.exec() && result.isActive())
    197196            {
    198197                while (result.next())
    199198                {
     
    287286                            "id = %1 AND is_default = 0;").arg(id);
    288287    result.prepare(querystr);
    289288   
    290     if (result.exec() && result.isActive() && result.size() > 0)
     289    if (result.exec() && result.isActive() && result.next())
    291290    {
    292         result.next();
    293291        QString message = QObject::tr("Delete profile group:") +
    294292                          QString("\n'%1'?").arg(ProfileGroup::getName(id));
    295293
  • tv_rec.cpp

     
    15701570    {
    15711571        MythContext::DBError("getstartchan3", query);
    15721572    }
    1573     else if (query.size() > 0)
     1573    else if (query.next())
    15741574    {
    1575         query.next();
    1576 
    15771575        QString test = query.value(0).toString();
    15781576        if (test != QString::null)
    15791577        {
     
    19541952                  "FROM channel "
    19551953                  "WHERE channel.chanid = :CHANID");
    19561954    query.bindValue(":CHANID", chanid);
    1957     if (!query.exec() || !query.isActive() || query.size() == 0)
     1955    if (!query.exec() || !query.isActive() || !query.next() )
    19581956    {
    19591957        MythContext::DBError("ShouldSwitchToAnotherCard", query);
    19601958        return false;
    19611959    }
    19621960
    1963     query.next();
    19641961    QString channelname = query.value(0).toString();
    19651962    QString callsign = query.value(1).toString();
    19661963
     
    19821979    {
    19831980        MythContext::DBError("ShouldSwitchToAnotherCard", query);
    19841981    }
    1985     else if (query.size() > 0)
     1982    else if (query.next())
    19861983    {
    19871984        msg = "Found channel (%1) on current card(%2).";
    19881985        VERBOSE(VB_RECORD, LOC + msg.arg(channelname).arg(cardid));
     
    21152112            {
    21162113                MythContext::DBError("checkchannel -- locate channum", query);
    21172114            }
    2118             else if (query.size())
     2115            else
    21192116            {
    21202117                while (query.next())
    21212118                {
     
    26392636    {
    26402637        MythContext::DBError("togglechannelfavorite", query);
    26412638    }
    2642     else if (query.size() > 0)
     2639    else if (query.next())
    26432640    {
    26442641        // We have a favorites record...Remove it to toggle...
    2645         query.next();
    26462642        QString favid = query.value(0).toString();
    26472643        query.prepare(
    26482644            QString("DELETE FROM favorites "
  • programinfo.cpp

     
    576576    query.prepare("SELECT icon FROM channel WHERE chanid = :CHANID ;");
    577577    query.bindValue(":CHANID", chanid);
    578578       
    579     if (query.exec() && query.isActive() && query.size() > 0)
    580         if (query.next())
     579    if (query.exec() && query.isActive() && query.next())
    581580            progMap["iconpath"] = query.value(0).toString();
    582581
    583582    progMap["RECSTATUS"] = RecStatusText();
     
    802801                  "WHERE basename = :BASENAME;");
    803802    query.bindValue(":BASENAME", filename);
    804803
    805     if (query.exec() && query.isActive() && query.size() > 0)
     804    if (query.exec() && query.isActive() && query.next())
    806805    {
    807         query.next();
    808 
    809806        return GetProgramFromRecorded(query.value(0).toString(),
    810807                                      query.value(1).toDateTime());
    811808    }
     
    847844    query.bindValue(":CHANNEL", channel);
    848845    query.bindValue(":STARTTIME", starttime);
    849846   
    850     if (query.exec() && query.isActive() && query.size() > 0)
     847    if (query.exec() && query.isActive() && query.next())
    851848    {
    852         query.next();
    853 
    854849        ProgramInfo *proginfo = new ProgramInfo;
    855850        proginfo->chanid = query.value(0).toString();
    856851        proginfo->startts = query.value(23).toDateTime();
     
    10251020    query.prepare("SELECT recpriority FROM channel WHERE chanid = :CHANID ;");
    10261021    query.bindValue(":CHANID", channel);
    10271022   
    1028     if (query.exec() && query.isActive() && query.size() > 0)
     1023    if (query.exec() && query.isActive() && query.next())
    10291024    {
    1030         query.next();
    10311025        return query.value(0).toInt();
    10321026    }
    10331027
     
    14851479
    14861480        if (!query.exec() || !query.isActive())
    14871481            MythContext::DBError("GetRecordBasename", query);
    1488         else if (query.size() < 1)
     1482        else if (!query.next())
    14891483            VERBOSE(VB_IMPORTANT, QString("GetRecordBasename found no entry"));
    14901484        else
    14911485        {
    1492             query.next();
    14931486            retval = query.value(0).toString();
    14941487        }
    14951488    }
     
    16631656    query.bindValue(":CHANID", pg->chanid);
    16641657    query.bindValue(":STARTS", pg->recstartts);
    16651658
    1666     if (!query.exec() || query.size())
     1659    if (!query.exec() || query.next())
    16671660    {
    16681661        if (!query.isActive())
    16691662            MythContext::DBError("insert_program -- select", query);
     
    18381831    query.bindValue(":CHANID", chanid);
    18391832    query.bindValue(":STARTTIME", recstartts);
    18401833   
    1841     if (query.exec() && query.isActive() && query.size() > 0)
     1834    if (query.exec() && query.isActive() && query.next())
    18421835    {
    1843         query.next();
    18441836        filesize = stringToLongLong(query.value(0).toString());
    18451837    }
    18461838    else
     
    19241916                        " WHERE serialid = ? ");
    19251917        query.addBindValue(serialid.utf8());
    19261918
    1927         if (query.exec() && query.isActive() && query.size() > 0)
     1919        if (query.exec() && query.isActive() && query.next())
    19281920        {
    1929             query.next();
    19301921            for(int i = 0; i < 4; i++)
    19311922                fields.append(query.value(i).toString());
    19321923        }
     
    20292020    query.bindValue(":CHANID", chanid);
    20302021    query.bindValue(":STARTTIME", recstartts);
    20312022
    2032     if (query.exec() && query.isActive() && query.size() > 0)
     2023    if (query.exec() && query.isActive() && query.next())
    20332024    {
    2034         query.next();
    20352025        return query.value(0).toBool();
    20362026    }
    20372027
     
    20972087    query.bindValue(":CHANID", chanid);
    20982088    query.bindValue(":STARTTIME", recstartts);
    20992089
    2100     if (query.exec() && query.isActive() && query.size() > 0)
     2090    if (query.exec() && query.isActive() && query.next())
    21012091    {
    2102         query.next();
    21032092        return query.value(0).toBool();
    21042093    }
    21052094
     
    21282117    query.bindValue(":ONEHOURAGO", oneHourAgo);
    21292118
    21302119    byWho = "";
    2131     if (query.exec() && query.isActive() && query.size() > 0)
     2120    if (query.exec() && query.isActive() && query.next())
    21322121    {
    21332122        QString usageStr, recusage;
    2134         while(query.next())
     2123        do
    21352124        {
    21362125            usageStr = QObject::tr("Unknown");
    21372126            recusage = query.value(1).toString();
     
    21482137                usageStr = QObject::tr("PIP");
    21492138
    21502139            byWho += query.value(0).toString() + " (" + usageStr + ")\n";
    2151         }
     2140        }
     2141        while(query.next());
    21522142
    21532143        return true;
    21542144    }
     
    21692159    query.bindValue(":CHANID", chanid);
    21702160    query.bindValue(":STARTTIME", recstartts);
    21712161
    2172     if (query.exec() && query.isActive() && query.size() > 0)
     2162    if (query.exec() && query.isActive() && query.next())
    21732163    {
    2174         query.next();
    21752164        return query.value(0).toInt();
    21762165    }
    21772166
     
    22972286    query.bindValue(":CHANID", chanid);
    22982287    query.bindValue(":STARTTIME", recstartts);
    22992288
    2300     if (query.exec() && query.isActive() && query.size() > 0)
     2289    if (query.exec() && query.isActive() && query.next())
    23012290    {
    2302         query.next();
    23032291        return query.value(0).toInt();
    23042292    }
    23052293
     
    23192307    query.bindValue(":CHANID", chanid);
    23202308    query.bindValue(":STARTTIME", recstartts);
    23212309
    2322     if (query.exec() && query.isActive() && query.size() > 0)
     2310    if (query.exec() && query.isActive() && query.next())
    23232311    {
    2324         query.next();
    23252312        return query.value(0).toBool();
    23262313    }
    23272314
     
    23392326                  "recordid = :RECID ;");
    23402327    query.bindValue(":RECID", recordid);
    23412328
    2342     if (query.exec() && query.isActive() && query.size() > 0)
     2329    if (query.exec() && query.isActive() && query.next())
    23432330    {
    2344         query.next();
    23452331        return query.value(0).toInt();
    23462332    }
    23472333
     
    24562442        if (!query.exec() || !query.isActive())
    24572443            MythContext::DBError("SetMarkupMap checking record table", query);
    24582444
    2459         if (query.size() < 1 || !query.next())
     2445        if (!query.next())
    24602446            return;
    24612447    }
    24622448 
     
    25312517    }
    25322518    query.bindValue(":TYPE", type);
    25332519
    2534     if (query.exec() && query.isActive() && query.size() > 0)
     2520    if (query.exec() && query.isActive())
    25352521    {
    25362522        while(query.next())
    25372523            marks[stringToLongLong(query.value(0).toString())] =
     
    25852571    }
    25862572    query.bindValue(":TYPE", type);
    25872573
    2588     if (query.exec() && query.isActive() && query.size() > 0)
     2574    if (query.exec() && query.isActive())
    25892575    {
    25902576        while (query.next())
    25912577            posMap[stringToLongLong(query.value(0).toString())] =
     
    34733459        query.bindValue(":CHANID", chanid);
    34743460        query.bindValue(":STARTTIME", startts);
    34753461
    3476         if (query.exec() && query.isActive() && query.size() > 0)
     3462        if (query.exec() && query.isActive() && query.next())
    34773463        {
    3478             query.next();
    34793464            category_type = query.value(0).toString();
    34803465            year = query.value(1).toString();
    34813466            stars = query.value(2).toDouble();
     
    35833568        query.bindValue(":CHANID", chanid);
    35843569        query.bindValue(":STARTTIME", startts);
    35853570
    3586         if (query.exec() && query.isActive() && query.size() > 0)
     3571        if (query.exec() && query.isActive())
    35873572        {
    35883573            while (query.next())
    35893574                s += ", " + query.value(0).toString();
     
    36323617        query.bindValue(":CHANID", chanid);
    36333618        query.bindValue(":STARTTIME", startts);
    36343619
    3635         if (query.exec() && query.isActive() && query.size() > 0)
     3620        if (query.exec() && query.isActive())
    36363621        {
    36373622            QString rstr = "", plist = "";
    36383623
     
    37243709        if (!query.exec() || !query.isActive())
    37253710            MythContext::DBError("showDetails", query);
    37263711
    3727         if (query.isActive() && query.size() > 0)
     3712        if (query.isActive() && query.next())
    37283713        {
    3729             query.next();
    37303714            if (p->recstatus == rsUnknown)
    37313715                p->recstatus = RecStatusType(query.value(0).toInt());
    37323716            if (p->recstatus == rsPreviousRecording ||
     
    37663750                      "WHERE recordid = :RECORDID");
    37673751        query.bindValue(":RECORDID", recordid);
    37683752       
    3769         if (query.exec() && query.isActive() && query.size() > 0)
     3753        if (query.exec() && query.isActive() && query.next())
    37703754        {
    3771             query.next();
    37723755            if (query.value(0).toDateTime().isValid())
    37733756                ADD_PAR(QObject::tr("Last Recorded"),
    37743757                        QObject::tr(query.value(0).toDateTime()
     
    38313814        query.bindValue(":CHANID", chanid);
    38323815        query.bindValue(":STARTTIME", recstartts);
    38333816       
    3834         if (query.exec() && query.isActive() && query.size() > 0)
     3817        if (query.exec() && query.isActive() && query.next())
    38353818        {
    3836             query.next();
    38373819            if (query.value(0).toString() > "")
    38383820                ADD_PAR(QObject::tr("Recording Profile"),
    38393821                        QObject::tr(query.value(0).toString()), msg)
     
    38723854    query.bindValue(":CHANID", chanid);
    38733855    query.bindValue(":STARTTIME", recstartts);
    38743856
    3875     if (query.exec() && query.isActive() && query.size() > 0)
     3857    if (query.exec() && query.isActive() && query.next())
    38763858    {
    3877         query.next();
    3878 
    38793859        flags |= (query.value(0).toInt() == COMM_FLAG_DONE) ? FL_COMMFLAG : 0;
    38803860        flags |= (query.value(1).toInt() == 1) ? FL_CUTLIST : 0;
    38813861        flags |= query.value(2).toInt() ? FL_AUTOEXP : 0;
     
    39303910                        "WHERE recgroup = :GROUP ;");
    39313911        query.bindValue(":GROUP", group.utf8());
    39323912
    3933         if (query.exec() && query.isActive() && query.size() > 0)
     3913        if (query.exec() && query.isActive() )
    39343914            if (query.next())
    39353915                result = query.value(0).toString();
    39363916    }
     
    39513931                    "AND starttime = :START ;");
    39523932    query.bindValue(":START", recstartts);
    39533933    query.bindValue(":CHANID", chanid);
    3954     if (query.exec() && query.isActive() && query.size() > 0)
     3934    if (query.exec() && query.isActive())
    39553935    {
    39563936        if(query.next() && recgroup != query.value(0).toString())
    39573937            recgroup = query.value(0).toString();
     
    46054585                  " FROM inuseprograms WHERE lastupdatetime >= :ONEHOURAGO ;");
    46064586    query.bindValue(":ONEHOURAGO", oneHourAgo);
    46074587
    4608     if (query.exec() && query.isActive() && query.size() > 0)
     4588    if (query.exec() && query.isActive())
    46094589    {
    46104590        while (query.next())
    46114591        {
  • scheduledrecording.cpp

     
    233233   
    234234        query.prepare(queryStr);
    235235       
    236         if (query.exec() && query.isActive() && query.size() > 0)
     236        if (query.exec() && query.isActive() && query.next() )
    237237        {
    238             query.next();
    239238            chanstr =  query.value(0).toString();
    240239            chansign =  query.value(1).toString();
    241240            channame =  query.value(2).toString();
     
    601600{
    602601    MSqlQuery result(MSqlQuery::InitCon());
    603602    result.prepare("SELECT recordid FROM record");
    604     if (result.exec() && result.isActive() && result.size() > 0)
     603    if (result.exec() && result.isActive())
    605604    {
    606605        while (result.next())
    607606        {
  • recordingprofile.cpp

     
    13251325        MythContext::DBError("RecordingProfile::fillSelections 1", result);
    13261326        return;
    13271327    }
    1328     else if (!result.size())
     1328    else if (!result.next())
    13291329        return;
    13301330
    13311331    if (group == RecordingProfile::TranscoderGroup && foldautodetect)
     
    13341334        setting->addSelection(QObject::tr("Autodetect"), id);
    13351335    }
    13361336
    1337     while (result.next())
     1337    do
    13381338    {
    13391339        QString name = result.value(0).toString();
    13401340        QString id   = result.value(1).toString();
     
    13581358
    13591359        setting->addSelection(name, id);
    13601360    }
     1361    while(result.next());
    13611362}
    13621363
    13631364void RecordingProfile::fillSelections(SelectManagedListItem *setting,
     
    13871388        MythContext::DBError("RecordingProfile::fillSelections 2", result);
    13881389        return;
    13891390    }
    1390     else if (!result.size())
     1391    else if (!result.next())
    13911392        return;
    13921393
    13931394    if (group == RecordingProfile::TranscoderGroup)
     
    13961397        setting->addSelection(QObject::tr("Transcode using Autodetect"), id);
    13971398    }
    13981399
    1399     while (result.next())
     1400    do
    14001401    {
    14011402        QString name = result.value(0).toString();
    14021403        QString id   = result.value(1).toString();
     
    14151416        QString lbl = QObject::tr("Record using the \"%1\" profile").arg(name);
    14161417        setting->addSelection(lbl, result.value(1).toString(), false);
    14171418    }
     1419    while (result.next());
    14181420}
    14191421
    14201422QString RecordingProfile::groupType(void) const
     
    14271429                        .arg(getProfileNum());
    14281430    result.prepare(querystr);
    14291431
    1430     if (result.exec() && result.isActive() && result.size() > 0)
     1432    if (result.exec() && result.isActive() && result.next())
    14311433    {
    1432         result.next();
    14331434        return (result.value(0).toString());
    14341435    }
    14351436
     
    14431444                                "id = %1;").arg(id);
    14441445    result.prepare(querystr);
    14451446
    1446     if (result.exec() && result.isActive() && result.size() > 0)
     1447    if (result.exec() && result.isActive() && result.next())
    14471448    {
    1448         result.next();
    14491449        return (result.value(0).toString());
    14501450    }
    14511451
  • scanwizardhelpers.cpp

     
    172172        "ORDER by frequency, networkid, transportid");
    173173    query.bindValue(":SOURCEID", sourceid);
    174174
    175     if (!query.exec() || !query.isActive() || query.size() <= 0)
     175    if (!query.exec() || !query.isActive())
    176176        return;
    177177
    178178    while (query.next())
  • sourceutil.cpp

     
    1717                  "WHERE sourceid = :SOURCEID");
    1818    query.bindValue(":SOURCEID", sourceid);
    1919
    20     if (query.exec() && query.isActive() && query.size() > 0)
     20    if (query.exec() && query.isActive() && query.next() )
    2121    {
    2222        QMap<QString,uint> counts;
    2323        const QRegExp sepExpr("(_|-|#|\\.)");
    24         while (query.next())
     24        do
    2525        {
    2626            const QString channum = query.value(0).toString();
    2727            const int where = channum.find(sepExpr);
     
    2929                counts["0"]++;
    3030            else
    3131                counts[(where < 0) ? "" : QString(channum.at(where))]++;
    32         }
     32        } while(query.next());
    3333        QString sep = "_";
    3434        uint max = counts["_"];
    3535        static char *spacers[6] = { "", "-", "#", ".", "0", NULL };