Ticket #6591: mythtv-6591-check_return_value_of_MSqlQuery_exec-libmythtv.patch
File mythtv-6591-check_return_value_of_MSqlQuery_exec-libmythtv.patch, 34.7 KB (added by , 15 years ago) |
---|
-
libs/libmythtv/dbcheck.cpp
old new 1055 1055 { 1056 1056 MSqlQuery query(MSqlQuery::InitCon()); 1057 1057 query.prepare("UPDATE record SET autocommflag = 1;"); 1058 query.exec(); 1058 if (!query.exec()) 1059 MythDB::DBError("dbcheck -- set autocommflag", query); 1059 1060 } 1060 1061 } 1061 1062 if (dbver == "1057") … … 1546 1547 update.prepare(QString( 1547 1548 "UPDATE record SET autotranscode = 1 WHERE recordid = %1;") 1548 1549 .arg(recordids.value(0).toInt())); 1549 update.exec(); 1550 if (!update.exec()) 1551 MythDB::DBError("dbcheck -- set autotranscode", update); 1550 1552 } 1551 1553 } 1552 1554 } … … 2151 2153 2152 2154 insert.bindValue(":TYPE", 1); 2153 2155 insert.bindValue(":MARK", start); 2154 insert.exec(); 2156 if (!insert.exec()) 2157 MythDB::DBError("dbcheck -- recordedmarkup, " 2158 "cut start", insert); 2155 2159 2156 2160 insert.bindValue(":TYPE", 0); 2157 2161 insert.bindValue(":MARK", end); 2158 insert.exec(); 2162 if (!insert.exec()) 2163 MythDB::DBError("dbcheck -- recordedmarkup, " 2164 "cut end", insert); 2159 2165 } 2160 2166 } 2161 2167 } … … 2594 2600 fixup.bindValue(":CHANID", query.value(0).toString()); 2595 2601 fixup.bindValue(":STARTTIME", query.value(1).toDateTime()); 2596 2602 2597 fixup.exec(); 2603 if (!fixup.exec()) 2604 MythDB::DBError("dbcheck -- cutlist", fixup); 2598 2605 } 2599 2606 } 2600 2607 … … 2653 2660 { 2654 2661 fixup.bindValue(":DATA", fixupMap[query.value(0).toInt()]); 2655 2662 fixup.bindValue(":HOSTNAME", query.value(1).toString()); 2656 fixup.exec(); 2663 if (!fixup.exec()) 2664 MythDB::DBError("dbcheck -- DisplayGroupDefaultViewMask", 2665 fixup); 2657 2666 } 2658 2667 } 2659 2668 … … 3009 3018 3010 3019 update.bindValue(":CHANID", airdates.value(0).toString()); 3011 3020 update.bindValue(":STARTTIME", airdates.value(1).toDateTime()); 3012 update.exec(); 3021 if (!update.exec()) 3022 MythDB::DBError("dbcheck -- DisplayGroupDefaultViewMask", 3023 update); 3013 3024 } 3014 3025 } 3015 3026 … … 3070 3081 "VALUES('Priority When Shown Once', :VALUE, " 3071 3082 "'program.first > 0 AND program.last > 0');"); 3072 3083 ppuq.bindValue(":VALUE", oncepriority); 3073 ppuq.exec(); 3084 if (!ppuq.exec()) 3085 MythDB::DBError("dbcheck -- OnceRecPriority", ppuq); 3074 3086 } 3075 3087 3076 3088 if (ccpriority) … … 3080 3092 "VALUES('Close Captioned Priority', :VALUE, " 3081 3093 "'program.closecaptioned > 0');"); 3082 3094 ppuq.bindValue(":VALUE", ccpriority); 3083 ppuq.exec(); 3095 if (!ppuq.exec()) 3096 MythDB::DBError("dbcheck -- CCRecPriority", ppuq); 3084 3097 } 3085 3098 3086 3099 if (!UpdateDBVersionNumber("1186")) … … 4508 4521 "VALUES (:CHANID, :GRPID);"); 4509 4522 update.bindValue(":CHANID", favorites.value(0).toInt()); 4510 4523 update.bindValue(":GRPID", 1); 4511 update.exec(); 4524 if (!update.exec()) 4525 MythDB::DBError("dbcheck -- channelgroup", update); 4512 4526 } 4513 4527 } 4514 4528 4515 4529 // finally drop the favorites table 4516 4530 favorites.prepare("DROP TABLE IF EXISTS favorites;"); 4517 favorites.exec(); 4531 if (!favorites.exec()) 4532 MythDB::DBError("dbcheck -- dropping favorites", favorites); 4518 4533 } 4519 4534 4520 4535 return true; -
libs/libmythtv/previouslist.cpp
old new 28 28 #include "mythdbcon.h" 29 29 #include "mythverbose.h" 30 30 #include "remoteutil.h" 31 #include "mythdb.h" 31 32 32 33 PreviousList::PreviousList(MythMainWindow *parent, const char *name, 33 34 int recid, QString ltitle) … … 756 757 MSqlQuery query(MSqlQuery::InitCon()); 757 758 query.prepare("DELETE FROM oldrecorded WHERE title = :TITLE ;"); 758 759 query.bindValue(":TITLE", pi->title); 759 query.exec(); 760 if (!query.exec()) 761 MythDB::DBError("PreviousList -- remove title", query); 760 762 761 763 ScheduledRecording::signalChange(0); 762 764 fillItemList(); … … 779 781 "WHERE chanid = :CHANID AND starttime = :STARTTIME ;"); 780 782 query.bindValue(":CHANID", pi->chanid); 781 783 query.bindValue(":STARTTIME", pi->startts.toString(Qt::ISODate)); 782 query.exec(); 784 if (!query.exec()) 785 MythDB::DBError("PreviousList -- delete item", query); 786 783 787 ScheduledRecording::signalChange(0); 784 788 fillItemList(); 785 789 } -
libs/libmythtv/programinfo.cpp
old new 1885 1885 query.prepare("UPDATE channel SET last_record = NOW() " 1886 1886 "WHERE chanid = :CHANID"); 1887 1887 query.bindValue(":CHANID", pg->chanid); 1888 query.exec(); 1888 if (!query.exec()) 1889 MythDB::DBError("insert_program -- channel last_record", query); 1889 1890 1890 1891 query.prepare("UPDATE record SET last_record = NOW() " 1891 1892 "WHERE recordid = :RECORDID"); 1892 1893 query.bindValue(":RECORDID", pg->recordid); 1893 query.exec(); 1894 if (!query.exec()) 1895 MythDB::DBError("insert_program -- record last_record", query); 1894 1896 1895 1897 if (pg->rectype == kOverrideRecord && pg->parentid > 0) 1896 1898 { 1897 1899 query.prepare("UPDATE record SET last_record = NOW() " 1898 1900 "WHERE recordid = :PARENTID"); 1899 1901 query.bindValue(":PARENTID", pg->parentid); 1900 query.exec(); 1902 if (!query.exec()) 1903 MythDB::DBError("insert_program -- record last_record override", 1904 query); 1901 1905 } 1902 1906 } 1903 1907 … … 1920 1924 query.bindValue(":CHANID", chanid); 1921 1925 query.bindValue(":STARTTIME", recstartts); 1922 1926 1923 query.exec(); 1924 1925 if (!query.isActive()) 1927 if (!query.exec() || !query.isActive()) 1926 1928 MythDB::DBError("FinishedRecording update", query); 1927 1929 1928 1930 GetProgramRecordingStatus(); … … 1945 1947 query.bindValue(":CHANID", chanid); 1946 1948 query.bindValue(":STARTTIME", recstartts); 1947 1949 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); 1952 1952 } 1953 1953 1954 1954 … … 3119 3119 query.bindValue(":CHANID", chanid); 3120 3120 query.bindValue(":STARTTIME", startts); 3121 3121 3122 query.exec(); 3123 if (!query.isActive()) 3122 if (!query.exec() || !query.isActive()) 3124 3123 MythDB::DBError("UpdateRes", query); 3125 3124 3126 3125 } … … 3133 3132 query.bindValue(":CHANID", chanid); 3134 3133 query.bindValue(":STARTTIME", startts); 3135 3134 3136 query.exec(); 3137 if (!query.isActive()) 3135 if (!query.exec() || !query.isActive()) 3138 3136 MythDB::DBError("UpdateRes", query); 3139 3137 } 3140 3138 else … … 3162 3160 result.bindValue(":TITLE", title); 3163 3161 result.bindValue(":STATION", chansign); 3164 3162 3165 result.exec(); 3166 if (!result.isActive()) 3163 if (!result.exec() || !result.isActive()) 3167 3164 MythDB::DBError("ReactivateRecording", result); 3168 3165 3169 3166 ScheduledRecording::signalChange(0); … … 3207 3204 result.bindValue(":DUPLICATE", dup); 3208 3205 result.bindValue(":REACTIVATE", reactivate); 3209 3206 3210 result.exec(); 3211 if (!result.isActive()) 3207 if (!result.exec() || !result.isActive()) 3212 3208 MythDB::DBError("addHistory", result); 3213 3209 3214 3210 if (dup && findid) … … 3218 3214 result.bindValue(":RECORDID", recordid); 3219 3215 result.bindValue(":FINDID", findid); 3220 3216 3221 result.exec(); 3222 if (!result.isActive()) 3217 if (!result.exec() || !result.isActive()) 3223 3218 MythDB::DBError("addFindHistory", result); 3224 3219 } 3225 3220 … … 3242 3237 result.bindValue(":START", recstartts); 3243 3238 result.bindValue(":STATION", chansign); 3244 3239 3245 result.exec(); 3246 if (!result.isActive()) 3240 if (!result.exec() || !result.isActive()) 3247 3241 MythDB::DBError("deleteHistory", result); 3248 3242 3249 3243 if (/*duplicate &&*/ findid) … … 3253 3247 result.bindValue(":RECORDID", recordid); 3254 3248 result.bindValue(":FINDID", findid); 3255 3249 3256 result.exec(); 3257 if (!result.isActive()) 3250 if (!result.exec() || !result.isActive()) 3258 3251 MythDB::DBError("deleteFindHistory", result); 3259 3252 } 3260 3253 … … 3283 3276 result.bindValue(":TITLE", title); 3284 3277 result.bindValue(":CHANID", chanid); 3285 3278 3286 result.exec(); 3287 if (!result.isActive()) 3279 if (!result.exec() || !result.isActive()) 3288 3280 MythDB::DBError("forgetRecorded", result); 3289 3281 3290 3282 result.prepare("UPDATE oldrecorded SET duplicate = 0 " … … 3300 3292 result.bindValue(":PROGRAMID", programid); 3301 3293 result.bindValue(":FINDID", findid); 3302 3294 3303 result.exec(); 3304 if (!result.isActive()) 3295 if (!result.exec() || !result.isActive()) 3305 3296 MythDB::DBError("forgetHistory", result); 3306 3297 3307 3298 result.prepare("DELETE FROM oldrecorded " 3308 3299 "WHERE recstatus = :NEVER AND duplicate = 0"); 3309 3300 result.bindValue(":NEVER", rsNeverRecord); 3310 3301 3311 result.exec(); 3312 if (!result.isActive()) 3302 if (!result.exec() || !result.isActive()) 3313 3303 MythDB::DBError("forgetNeverHisttory", result); 3314 3304 3315 3305 if (findid) … … 3319 3309 result.bindValue(":RECORDID", recordid); 3320 3310 result.bindValue(":FINDID", findid); 3321 3311 3322 result.exec(); 3323 if (!result.isActive()) 3312 if (!result.exec() || !result.isActive()) 3324 3313 MythDB::DBError("forgetFindHistory", result); 3325 3314 } 3326 3315 … … 3349 3338 result.bindValue(":PROGRAMID", programid); 3350 3339 result.bindValue(":FINDID", findid); 3351 3340 3352 result.exec(); 3353 if (!result.isActive()) 3341 if (!result.exec() || !result.isActive()) 3354 3342 MythDB::DBError("setDupHistory", result); 3355 3343 3356 3344 ScheduledRecording::signalChange(0); … … 3973 3961 query.bindValue(":HOSTNAME", gContext->GetHostName()); 3974 3962 query.bindValue(":RECUSAGE", inUseForWhat); 3975 3963 3976 query.exec(); 3964 if (!query.exec()) 3965 MythDB::DBError("MarkAsInUse -- delete", query); 3977 3966 3978 3967 if (!inuse) 3979 3968 { -
libs/libmythtv/jobqueue.cpp
old new 534 534 query.bindValue(":STARTTIME", starttime); 535 535 query.bindValue(":JOBTYPE", jobType); 536 536 537 query.exec(); 538 539 if (!query.isActive()) 537 if (!query.exec() || !query.isActive()) 540 538 { 541 539 MythDB::DBError("Error in JobQueue::QueueJob()", query); 542 540 return false; … … 584 582 query.bindValue(":COMMENT", comment); 585 583 query.bindValue(":FLAGS", flags); 586 584 587 query.exec(); 588 589 if (!query.isActive()) 585 if (!query.exec() || !query.isActive()) 590 586 { 591 587 MythDB::DBError("Error in JobQueue::StartJob()", query); 592 588 return false; … … 648 644 query.bindValue(":STARTTIME", starttime); 649 645 query.bindValue(":JOBTYPE", jobType); 650 646 651 query.exec(); 652 653 if (!query.isActive()) 647 if (!query.exec() || !query.isActive()) 654 648 { 655 649 MythDB::DBError("Error in JobQueue::GetJobID()", query); 656 650 return -1; … … 674 668 675 669 query.bindValue(":ID", jobID); 676 670 677 query.exec(); 678 679 if (!query.isActive()) 671 if (!query.exec() || !query.isActive()) 680 672 { 681 673 MythDB::DBError("Error in JobQueue::GetJobID()", query); 682 674 return false; … … 758 750 query.bindValue(":STARTTIME", starttime); 759 751 query.bindValue(":QUEUED", JOB_QUEUED); 760 752 761 query.exec(); 762 763 if (!query.isActive()) 753 if (!query.exec() || !query.isActive()) 764 754 MythDB::DBError("Cancel Pending Jobs", query); 765 755 766 756 query.prepare("UPDATE jobqueue SET cmds = :CMD " … … 795 785 query.bindValue(":ERRORED", JOB_ERRORED); 796 786 query.bindValue(":CANCELLED", JOB_CANCELLED); 797 787 798 query.exec();799 800 788 if (!query.exec() || !query.isActive()) 801 789 { 802 790 MythDB::DBError("Stop Unfinished Jobs", query); … … 827 815 query.bindValue(":CHANID", chanid); 828 816 query.bindValue(":STARTTIME", starttime); 829 817 830 query.exec(); 831 832 if (!query.isActive()) 818 if (!query.exec() || !query.isActive()) 833 819 MythDB::DBError("Delete All Jobs", query); 834 820 } 835 821 else … … 883 869 884 870 query.bindValue(":ID", jobID); 885 871 886 query.exec(); 887 888 if (!query.isActive()) 872 if (!query.exec() || !query.isActive()) 889 873 { 890 874 MythDB::DBError("Error in JobQueue::DeleteJob()", query); 891 875 return false; … … 906 890 query.bindValue(":CMDS", newCmds); 907 891 query.bindValue(":ID", jobID); 908 892 909 query.exec(); 910 911 if (!query.isActive()) 893 if (!query.exec() || !query.isActive()) 912 894 { 913 895 MythDB::DBError("Error in JobQueue::ChangeJobCmds()", query); 914 896 return false; … … 930 912 query.bindValue(":CHANID", chanid); 931 913 query.bindValue(":STARTTIME", starttime); 932 914 933 query.exec(); 934 935 if (!query.isActive()) 915 if (!query.exec() || !query.isActive()) 936 916 { 937 917 MythDB::DBError("Error in JobQueue::ChangeJobCmds()", query); 938 918 return false; … … 953 933 query.bindValue(":FLAGS", newFlags); 954 934 query.bindValue(":ID", jobID); 955 935 956 query.exec(); 957 958 if (!query.isActive()) 936 if (!query.exec() || !query.isActive()) 959 937 { 960 938 MythDB::DBError("Error in JobQueue::ChangeJobFlags()", query); 961 939 return false; … … 981 959 query.bindValue(":COMMENT", comment); 982 960 query.bindValue(":ID", jobID); 983 961 984 query.exec(); 985 986 if (!query.isActive()) 962 if (!query.exec() || !query.isActive()) 987 963 { 988 964 MythDB::DBError("Error in JobQueue::ChangeJobStatus()", query); 989 965 return false; … … 1008 984 query.bindValue(":COMMENT", comment); 1009 985 query.bindValue(":ID", jobID); 1010 986 1011 query.exec(); 1012 1013 if (!query.isActive()) 987 if (!query.exec() || !query.isActive()) 1014 988 { 1015 989 MythDB::DBError("Error in JobQueue::ChangeJobComment()", query); 1016 990 return false; … … 1032 1006 query.bindValue(":ARGS", args); 1033 1007 query.bindValue(":ID", jobID); 1034 1008 1035 query.exec(); 1036 1037 if (!query.isActive()) 1009 if (!query.exec() || !query.isActive()) 1038 1010 { 1039 1011 MythDB::DBError("Error in JobQueue::ChangeJobArgs()", query); 1040 1012 return false; … … 1442 1414 1443 1415 query.bindValue(":ID", jobID); 1444 1416 1445 query.exec(); 1446 1447 if (query.isActive()) 1417 if (query.exec() && query.isActive()) 1448 1418 { 1449 1419 if (query.next()) 1450 1420 return (enum JobCmds)query.value(0).toInt(); … … 1465 1435 1466 1436 query.bindValue(":ID", jobID); 1467 1437 1468 query.exec(); 1469 1470 if (query.isActive()) 1438 if (query.exec() && query.isActive()) 1471 1439 { 1472 1440 if (query.next()) 1473 1441 return query.value(0).toString(); … … 1488 1456 1489 1457 query.bindValue(":ID", jobID); 1490 1458 1491 query.exec(); 1492 1493 if (query.isActive()) 1459 if (query.exec() && query.isActive()) 1494 1460 { 1495 1461 if (query.next()) 1496 1462 return (enum JobFlags)query.value(0).toInt(); … … 1511 1477 1512 1478 query.bindValue(":ID", jobID); 1513 1479 1514 query.exec(); 1515 1516 if (query.isActive()) 1480 if (query.exec() && query.isActive()) 1517 1481 { 1518 1482 if (query.next()) 1519 1483 return (enum JobStatus)query.value(0).toInt(); … … 1537 1501 query.bindValue(":CHANID", chanid); 1538 1502 query.bindValue(":STARTTIME", startts); 1539 1503 1540 query.exec(); 1541 1542 if (query.isActive()) 1504 if (query.exec() && query.isActive()) 1543 1505 { 1544 1506 if (query.next()) 1545 1507 return (enum JobStatus)query.value(0).toInt(); … … 1947 1909 MSqlQuery query(MSqlQuery::InitCon()); 1948 1910 query.prepare("SELECT name FROM recordingprofiles WHERE id = :ID;"); 1949 1911 query.bindValue(":ID", transcoder); 1950 query.exec(); 1951 if (query.isActive() && query.next()) 1912 if (query.exec() && query.isActive() && query.next()) 1952 1913 { 1953 1914 transcoderName = query.value(0).toString(); 1954 1915 } -
libs/libmythtv/livetvchain.cpp
old new 151 151 query.bindValue(":START", (*it).starttime); 152 152 query.bindValue(":CHAINID", m_id); 153 153 query.bindValue(":DISCONT", true); 154 query.exec(); 154 if (!query.exec()) 155 MythDB::DBError("LiveTVChain::DeleteProgram -- " 156 "discontinuity", query); 155 157 } 156 158 157 159 query.prepare("DELETE FROM tvchain WHERE chanid = :CHANID " … … 159 161 query.bindValue(":CHANID", (*del).chanid); 160 162 query.bindValue(":START", (*del).starttime); 161 163 query.bindValue(":CHAINID", m_id); 162 query.exec(); 164 if (!query.exec()) 165 MythDB::DBError("LiveTVChain::DeleteProgram -- delete", query); 163 166 164 167 m_chain.erase(del); 165 168 … … 186 189 query.prepare("DELETE FROM tvchain WHERE chainid = :CHAINID ;"); 187 190 query.bindValue(":CHAINID", m_id); 188 191 189 query.exec(); 192 if (!query.exec()) 193 MythDB::DBError("LiveTVChain::DestroyChain", query); 190 194 } 191 195 192 196 void LiveTVChain::ReloadAll(void) -
libs/libmythtv/videosource.cpp
old new 731 731 "SET userid=NULL, password=NULL " 732 732 "WHERE xmltvgrabber NOT IN ( 'datadirect', 'technovera', " 733 733 " 'schedulesdirect1' )"); 734 query.exec(); 734 if (!query.exec()) 735 MythDB::DBError("XMLTVConfig::Save", query); 735 736 } 736 737 737 738 VideoSource::VideoSource() … … 2531 2532 MSqlQuery query(MSqlQuery::InitCon()); 2532 2533 query.prepare("DELETE FROM cardinput WHERE cardinputid = :INPUTID"); 2533 2534 query.bindValue(":INPUTID", getInputID()); 2534 query.exec(); 2535 if (!query.exec()) 2536 MythDB::DBError("CardInput::Save", query); 2535 2537 } 2536 2538 else 2537 2539 { -
libs/libmythtv/scheduledrecording.cpp
old new 536 536 MSqlQuery query(MSqlQuery::InitCon()); 537 537 querystr = QString("DELETE FROM record WHERE recordid = %1").arg(rid); 538 538 query.prepare(querystr); 539 query.exec(); 539 if (!query.exec()) 540 MythDB::DBError("ScheduledRecording::remove -- record", query); 540 541 541 542 querystr = QString("DELETE FROM oldfind WHERE recordid = %1").arg(rid); 542 543 query.prepare(querystr); 543 query.exec(); 544 if (!query.exec()) 545 MythDB::DBError("ScheduledRecording::remove -- oldfind", query); 544 546 } 545 547 546 548 void ScheduledRecording::signalChange(int recordid) … … 1035 1037 thequery = QString("SELECT MAX(recordid) FROM %1 ORDER BY recordid;") 1036 1038 .arg(ttable); 1037 1039 query.prepare(thequery); 1038 query.exec(); 1039 if (query.isActive() && query.next()) 1040 if (query.exec() && query.isActive() && query.next()) 1040 1041 id->setValue(query.value(0).toInt() + 1); 1041 1042 else 1042 1043 id->setValue(100000); -
libs/libmythtv/playgroup.cpp
old new 186 186 query.bindValue(":TITLE1", pi->title); 187 187 query.bindValue(":TITLE2", pi->title); 188 188 query.bindValue(":CATEGORY", pi->category); 189 query.exec();190 189 191 190 if (!query.exec()) 192 191 MythDB::DBError("GetInitialName", query); -
libs/libmythtv/channelgroup.cpp
old new 53 53 query.prepare( 54 54 QString("DELETE FROM channelgroup " 55 55 "WHERE id = '%1'").arg(id)); 56 query.exec(); 56 if (!query.exec()) 57 MythDB::DBError("ChannelGroup::ToggleChannel -- delete", query); 57 58 VERBOSE(VB_IMPORTANT, LOC + QString("Removing channel with id=%1.").arg(id)); 58 59 } 59 60 else if (query.size() == 0) … … 62 63 query.prepare( 63 64 QString("INSERT INTO channelgroup (chanid,grpid) " 64 65 "VALUES ('%1','%2')").arg(chanid).arg(changrpid)); 65 query.exec(); 66 if (!query.exec()) 67 MythDB::DBError("ChannelGroup::ToggleChannel -- insert", query); 66 68 VERBOSE(VB_IMPORTANT, LOC + QString("Adding channel %1 to group %2.").arg(chanid).arg(changrpid)); 67 69 } 68 70 … … 84 86 85 87 if (!query.exec() || !query.isActive()) 86 88 { 87 MythDB::DBError("ChannelGroup:: ToggleChannel", query);89 MythDB::DBError("ChannelGroup::AddChannel", query); 88 90 return false; 89 91 } 90 92 else if (query.size() == 0) … … 93 95 query.prepare( 94 96 QString("INSERT INTO channelgroup (chanid,grpid) " 95 97 "VALUES ('%1','%2')").arg(chanid).arg(changrpid)); 96 query.exec(); 98 if (!query.exec()) 99 MythDB::DBError("ChannelGroup::AddChannel -- insert", query); 97 100 VERBOSE(VB_IMPORTANT, LOC + QString("Adding channel %1 to group %2.").arg(chanid).arg(changrpid)); 98 101 } 99 102 … … 115 118 116 119 if (!query.exec() || !query.isActive()) 117 120 { 118 MythDB::DBError("ChannelGroup:: ToggleChannel", query);121 MythDB::DBError("ChannelGroup::DeleteChannel", query); 119 122 return false; 120 123 } 121 124 else if (query.size() > 0) … … 126 129 query.prepare( 127 130 QString("DELETE FROM channelgroup " 128 131 "WHERE id = '%1'").arg(id)); 129 query.exec(); 132 if (!query.exec()) 133 MythDB::DBError("ChannelGroup::DeleteChannel -- delete", query); 130 134 VERBOSE(VB_IMPORTANT, LOC + QString("Removing channel with id=%1.").arg(id)); 131 135 } 132 136 -
libs/libmythtv/proglist_qt.cpp
old new 27 27 #include "mythdbcon.h" 28 28 #include "mythverbose.h" 29 29 #include "channelutil.h" 30 #include "mythdb.h" 30 31 31 32 ProgListerQt::ProgListerQt(ProgListTypeQt pltype, 32 33 const QString &view, const QString &from, … … 495 496 "WHERE phrase = :PHRASE AND searchtype = :TYPE;"); 496 497 query.bindValue(":PHRASE", qphrase); 497 498 query.bindValue(":TYPE", searchtype); 498 query.exec(); 499 if (!query.exec()) 500 MythDB::DBError("ProgListerQt::updateKeywordInDB -- delete", 501 query); 499 502 } 500 503 if (newview < 0) 501 504 { … … 506 509 "VALUES(:PHRASE, :TYPE );"); 507 510 query.bindValue(":PHRASE", qphrase); 508 511 query.bindValue(":TYPE", searchtype); 509 query.exec(); 512 if (!query.exec()) 513 MythDB::DBError("ProgListerQt::updateKeywordInDB -- replace", 514 query); 510 515 } 511 516 } 512 517 } … … 644 649 "WHERE phrase = :PHRASE AND searchtype = :TYPE;"); 645 650 query.bindValue(":PHRASE", qphrase); 646 651 query.bindValue(":TYPE", searchtype); 647 query.exec(); 652 if (!query.exec()) 653 MythDB::DBError("ProgListerQt::deleteKeyword", query); 648 654 649 655 chooseListBox->removeRow(view + 1); 650 656 viewList.removeAll(text); … … 985 991 MSqlQuery query(MSqlQuery::InitCon()); 986 992 987 993 query.prepare("SELECT genre FROM programgenres GROUP BY genre;"); 988 query.exec();989 994 990 if (query. isActive() && query.size())995 if (query.exec() && query.isActive()) 991 996 { 992 997 while (query.next()) 993 998 { … … 1262 1267 "WHERE program.endtime > :PGILSTART " 1263 1268 "GROUP BY g1.genre, g2.genre;"); 1264 1269 query.bindValue(":PGILSTART", startstr); 1265 query.exec();1266 1270 1267 if (query. isActive() && query.size())1271 if (query.exec() && query.isActive() && query.size()) 1268 1272 { 1269 1273 QString lastGenre1; 1270 1274 … … 1298 1302 "WHERE program.endtime > :PGILSTART " 1299 1303 "GROUP BY category;"); 1300 1304 query.bindValue(":PGILSTART", startstr); 1301 query.exec();1302 1305 1303 if (query. isActive() && query.size())1306 if (query.exec() && query.isActive()) 1304 1307 { 1305 1308 while (query.next()) 1306 1309 { … … 1326 1329 query.prepare("SELECT phrase FROM keyword " 1327 1330 "WHERE searchtype = :SEARCHTYPE;"); 1328 1331 query.bindValue(":SEARCHTYPE", searchtype); 1329 query.exec();1330 1332 1331 if (query. isActive() && query.size())1333 if (query.exec() && query.isActive()) 1332 1334 { 1333 1335 while (query.next()) 1334 1336 { … … 1353 1355 "VALUES(:VIEW, :SEARCHTYPE );"); 1354 1356 query.bindValue(":VIEW", qphrase); 1355 1357 query.bindValue(":SEARCHTYPE", searchtype); 1356 query.exec(); 1358 if (!query.exec()) 1359 MythDB::DBError("ProgListerQt::fillViewList -- replace", 1360 query); 1357 1361 1358 1362 viewList << qphrase; 1359 1363 viewTextList << qphrase; … … 1451 1455 query.prepare("SELECT title FROM record " 1452 1456 "WHERE recordid = :RECORDID"); 1453 1457 query.bindValue(":RECORDID", view); 1454 query.exec();1455 1458 1456 if (query. isActive() && query.size())1459 if (query.exec() && query.isActive()) 1457 1460 { 1458 1461 if (query.next()) 1459 1462 { … … 1469 1472 MSqlQuery query(MSqlQuery::InitCon()); 1470 1473 query.prepare("SELECT rulename FROM customexample " 1471 1474 "WHERE search > 0 ORDER BY rulename;"); 1472 query.exec();1473 1475 1474 if (query. isActive() && query.size())1476 if (query.exec() && query.isActive()) 1475 1477 { 1476 1478 while (query.next()) 1477 1479 { … … 1719 1721 query.prepare("SELECT fromclause, whereclause FROM customexample " 1720 1722 "WHERE rulename = :RULENAME;"); 1721 1723 query.bindValue(":RULENAME", qphrase); 1722 query.exec();1723 1724 1724 if (query. isActive() && query.size())1725 if (query.exec() && query.isActive()) 1725 1726 { 1726 1727 query.next(); 1727 1728 fromc = query.value(0).toString(); -
libs/libmythtv/profilegroup.cpp
old new 214 214 "(name, profilegroup) VALUES (:NAME, :PROFID);"); 215 215 result.bindValue(":NAME", availProfiles[i]); 216 216 result.bindValue(":PROFID", profileID); 217 result.exec(); 217 if (!result.exec()) 218 MythDB::DBError("ProfileGroup::getHostNames", result); 218 219 } 219 220 } 220 221 } … … 305 306 "codecparams.profile = recordingprofiles.id " 306 307 "AND recordingprofiles.profilegroup = %1").arg(id); 307 308 result.prepare(querystr); 308 result.exec(); 309 if (!result.exec()) 310 MythDB::DBError("ProfileGroupEditor::callDelete -- " 311 "delete codecparams", result); 309 312 310 313 querystr = QString("DELETE FROM recordingprofiles WHERE " 311 314 "profilegroup = %1").arg(id); 312 315 result.prepare(querystr); 313 result.exec(); 316 if (!result.exec()) 317 MythDB::DBError("ProfileGroupEditor::callDelete -- " 318 "delete recordingprofiles", result); 314 319 315 320 querystr = QString("DELETE FROM profilegroups WHERE id = %1;").arg(id); 316 321 result.prepare(querystr); 317 result.exec(); 322 if (!result.exec()) 323 MythDB::DBError("ProfileGroupEditor::callDelete -- " 324 "delete profilegroups", result); 318 325 319 326 redraw = true; 320 327 -
libs/libmythtv/programdata.cpp
old new 36 36 37 37 query.prepare("SELECT tmoffset FROM channel where chanid = :CHANID ;"); 38 38 query.bindValue(":CHANID", chanid); 39 query.exec(); 40 if (!query.isActive() || query.size() != 1) 39 if (!query.exec() || !query.isActive() || query.size() != 1) 41 40 { 42 41 MythDB::DBError("clearDataByChannel", query); 43 42 return; … … 55 54 query.bindValue(":FROM", newFrom); 56 55 query.bindValue(":TO", newTo); 57 56 query.bindValue(":CHANID", chanid); 58 query.exec(); 57 if (!query.exec()) 58 MythDB::DBError("ProgramData::clearDataByChannel -- delete program", 59 query); 59 60 60 61 query.prepare("DELETE FROM programrating " 61 62 "WHERE starttime >= :FROM AND starttime < :TO " … … 63 64 query.bindValue(":FROM", newFrom); 64 65 query.bindValue(":TO", newTo); 65 66 query.bindValue(":CHANID", chanid); 66 query.exec(); 67 if (!query.exec()) 68 MythDB::DBError("ProgramData::clearDataByChannel -- " 69 "delete programrating", query); 67 70 68 71 query.prepare("DELETE FROM credits " 69 72 "WHERE starttime >= :FROM AND starttime < :TO " … … 71 74 query.bindValue(":FROM", newFrom); 72 75 query.bindValue(":TO", newTo); 73 76 query.bindValue(":CHANID", chanid); 74 query.exec(); 77 if (!query.exec()) 78 MythDB::DBError("ProgramData::clearDataByChannel -- delete credits", 79 query); 75 80 76 81 query.prepare("DELETE FROM programgenres " 77 82 "WHERE starttime >= :FROM AND starttime < :TO " … … 79 84 query.bindValue(":FROM", newFrom); 80 85 query.bindValue(":TO", newTo); 81 86 query.bindValue(":CHANID", chanid); 82 query.exec(); 87 if (!query.exec()) 88 MythDB::DBError("ProgramData::clearDataByChannel -- " 89 "delete programgenres", query); 83 90 } 84 91 85 92 void ProgramData::clearDataBySource(int sourceid, QDateTime from, QDateTime to) … … 203 210 chanQuery.bindValue(":ID", id); 204 211 chanQuery.bindValue(":XMLTVID", mapiter.key()); 205 212 206 chanQuery.exec(); 207 208 if (!chanQuery.isActive() || chanQuery.size() <= 0) 213 if (!chanQuery.exec() || !chanQuery.isActive() || chanQuery.size() <= 0) 209 214 { 210 215 VERBOSE(VB_IMPORTANT, QString("Unknown xmltv channel identifier: " 211 216 "%1 - Skipping channel.") … … 275 280 query.bindValue(":COLORCODE", (*i).colorcode); 276 281 query.bindValue(":SYNDICATEDEPISODENUMBER", (*i).syndicatedepisodenumber); 277 282 query.bindValue(":PROGRAMID", (*i).programid); 278 query.exec();279 283 280 if (query. isActive() && query.size() > 0)284 if (query.exec() && query.isActive() && query.size() > 0) 281 285 { 282 286 unchanged++; 283 287 continue; … … 289 293 query.bindValue(":CHANID", chanid); 290 294 query.bindValue(":START", (*i).start); 291 295 query.bindValue(":END", (*i).end); 292 query.exec();293 296 294 if (query. isActive() && query.size() > 0)297 if (query.exec() && query.isActive() && query.size() > 0) 295 298 { 296 299 297 300 while (query.next()) … … 319 322 subquery.bindValue(":START", (*i).start); 320 323 subquery.bindValue(":END", (*i).end); 321 324 322 subquery.exec(); 325 if (!subquery.exec()) 326 MythDB::DBError("ProgramData::handlePrograms -- " 327 "delete program", subquery); 323 328 324 329 subquery.prepare("DELETE FROM programrating WHERE " 325 330 "chanid=:CHANID AND starttime>=:START " … … 328 333 subquery.bindValue(":START", (*i).start); 329 334 subquery.bindValue(":END", (*i).end); 330 335 331 subquery.exec(); 336 if (!subquery.exec()) 337 MythDB::DBError("ProgramData::handlePrograms -- " 338 "delete programrating", subquery); 332 339 333 340 subquery.prepare("DELETE FROM credits WHERE " 334 341 "chanid=:CHANID AND starttime>=:START " … … 337 344 subquery.bindValue(":START", (*i).start); 338 345 subquery.bindValue(":END", (*i).end); 339 346 340 subquery.exec(); 347 if (!subquery.exec()) 348 MythDB::DBError("ProgramData::handlePrograms -- " 349 "delete credits", subquery); 341 350 } 342 351 343 352 query.prepare("INSERT INTO program (chanid,starttime,endtime,"