Ticket #6591: mythtv-6591-check_return_value_of_MSqlQuery_exec-programs.2.patch
File mythtv-6591-check_return_value_of_MSqlQuery_exec-programs.2.patch, 45.1 KB (added by , 15 years ago) |
---|
-
programs/mythfrontend/main.cpp
old new 63 63 #include "mythdirs.h" 64 64 #include "mythosdmenueditor.h" 65 65 #include "audiopulseutil.h" 66 #include "mythdb.h" 66 67 67 68 static ExitPrompter *exitPopup = NULL; 68 69 static MythThemedMenu *menu; … … 982 983 query.prepare("DELETE FROM inuseprograms " 983 984 "WHERE hostname = :HOSTNAME and recusage = 'player' ;"); 984 985 query.bindValue(":HOSTNAME", gContext->GetHostName()); 985 query.exec(); 986 if (!query.exec()) 987 MythDB::DBError("CleanupMyOldInUsePrograms", query); 986 988 } 987 989 988 990 void ShowUsage(const MythCommandLineParser &cmdlineparser) … … 1293 1295 query.prepare("update settings set data='EN' " 1294 1296 "WHERE hostname = :HOSTNAME and value='Language' ;"); 1295 1297 query.bindValue(":HOSTNAME", gContext->GetHostName()); 1296 query.exec(); 1298 if (!query.exec()) 1299 MythDB::DBError("Updating language", query); 1297 1300 1298 1301 return FRONTEND_EXIT_OK; 1299 1302 } -
programs/mythfrontend/manualschedule.cpp
old new 207 207 "FROM channel WHERE chanid=:CHANID"); 208 208 query.bindValue(":CHANID", p.chanid); 209 209 210 query.exec(); 211 212 if (query.isActive() && query.size()) 210 if (query.exec() && query.next()) 213 211 { 214 query.next();215 212 p.chanstr = query.value(1).toString(); 216 213 p.chansign = query.value(2).toString(); 217 214 p.channame = query.value(3).toString(); -
programs/mythfrontend/playbackbox.cpp
old new 19 19 20 20 #include "mythdirs.h" 21 21 #include "mythcontext.h" 22 #include "mythdb.h" 22 23 #include "mythdbcon.h" 23 24 #include "mythverbose.h" 24 25 #include "programinfo.h" … … 4179 4180 "WHERE recgroup = :RECGROUP ;"); 4180 4181 query.bindValue(":RECGROUP", m_recGroup); 4181 4182 4182 query.exec(); 4183 if (!query.exec()) 4184 MythDB::DBError("PlaybackBox::SetRecGroupPassword -- delete", 4185 query); 4183 4186 4184 4187 if (!newPassword.isEmpty()) 4185 4188 { … … 4189 4192 query.bindValue(":RECGROUP", m_recGroup); 4190 4193 query.bindValue(":PASSWD", newPassword); 4191 4194 4192 query.exec(); 4195 if (!query.exec()) 4196 MythDB::DBError("PlaybackBox::SetRecGroupPassword -- insert", 4197 query); 4193 4198 } 4194 4199 } 4195 4200 -
programs/mythcommflag/CommDetector2.cpp
old new 225 225 ";"); 226 226 query.bindValue(":CHANID", chanid); 227 227 query.bindValue(":STARTTIME", recstartts); 228 query.exec(); 229 if (query.size() <= 0 || !query.next()) 228 if (!query.exec() || query.size() <= 0 || !query.next()) 230 229 { 231 230 MythDB::DBError("Error in CommDetector2::CommDetector2", query); 232 231 return ""; -
programs/mythfrontend/proglist.cpp
old new 19 19 #include "channelutil.h" 20 20 21 21 // mythdb 22 #include "libmythdb/mythdb.h" 22 23 #include "libmythdb/mythdbcon.h" 23 24 #include "libmythdb/mythverbose.h" 24 25 … … 385 386 "WHERE phrase = :PHRASE AND searchtype = :TYPE;"); 386 387 query.bindValue(":PHRASE", qphrase); 387 388 query.bindValue(":TYPE", m_searchType); 388 query.exec(); 389 if (!query.exec()) 390 MythDB::DBError("ProgLister::updateKeywordInDB -- delete", 391 query); 389 392 390 393 m_viewList.removeAll(qphrase); 391 394 m_viewTextList.removeAll(qphrase); … … 399 402 "VALUES(:PHRASE, :TYPE );"); 400 403 query.bindValue(":PHRASE", qphrase); 401 404 query.bindValue(":TYPE", m_searchType); 402 query.exec(); 405 if (!query.exec()) 406 MythDB::DBError("ProgLister::updateKeywordInDB -- replace", 407 query); 403 408 404 409 m_viewList.append(qphrase); 405 410 m_viewTextList.append(qphrase); … … 739 744 "WHERE chanid = :CHANID AND starttime = :STARTTIME ;"); 740 745 query.bindValue(":CHANID", pi->chanid); 741 746 query.bindValue(":STARTTIME", pi->startts.toString(Qt::ISODate)); 742 query.exec(); 747 if (!query.exec()) 748 MythDB::DBError("ProgLister::doDeleteOldRecorded", query); 743 749 ScheduledRecording::signalChange(0); 744 750 } 745 751 … … 807 813 "WHERE program.endtime > :PGILSTART " 808 814 "GROUP BY g1.genre, g2.genre;"); 809 815 query.bindValue(":PGILSTART", startstr); 810 query.exec();811 816 812 if (query. isActive() && query.size())817 if (query.exec() && query.size()) 813 818 { 814 819 QString lastGenre1; 815 820 … … 843 848 "WHERE program.endtime > :PGILSTART " 844 849 "GROUP BY category;"); 845 850 query.bindValue(":PGILSTART", startstr); 846 query.exec();847 851 848 if (query. isActive() && query.size())852 if (query.exec()) 849 853 { 850 854 while (query.next()) 851 855 { … … 871 875 query.prepare("SELECT phrase FROM keyword " 872 876 "WHERE searchtype = :SEARCHTYPE;"); 873 877 query.bindValue(":SEARCHTYPE", m_searchType); 874 query.exec();875 878 876 if (query. isActive() && query.size())879 if (query.exec()) 877 880 { 878 881 while (query.next()) 879 882 { … … 898 901 "VALUES(:VIEW, :SEARCHTYPE );"); 899 902 query.bindValue(":VIEW", qphrase); 900 903 query.bindValue(":SEARCHTYPE", m_searchType); 901 query.exec(); 904 if (!query.exec()) 905 MythDB::DBError("ProgLister::fillViewList -- " 906 "replace keyword", query); 902 907 903 908 m_viewList << qphrase; 904 909 m_viewTextList << qphrase; … … 1000 1005 query.prepare("SELECT title FROM record " 1001 1006 "WHERE recordid = :RECORDID"); 1002 1007 query.bindValue(":RECORDID", view); 1003 query.exec();1004 1008 1005 if (query. isActive() && query.size())1009 if (query.exec() && query.next()) 1006 1010 { 1007 if (query.next()) 1008 { 1009 QString title = query.value(0).toString(); 1010 title = query.value(0).toString(); 1011 m_viewList << view; 1012 m_viewTextList << title; 1013 } 1011 QString title = query.value(0).toString(); 1012 title = query.value(0).toString(); 1013 m_viewList << view; 1014 m_viewTextList << title; 1014 1015 } 1015 1016 } 1016 1017 else if (m_type == plStoredSearch) // stored searches … … 1018 1019 MSqlQuery query(MSqlQuery::InitCon()); 1019 1020 query.prepare("SELECT rulename FROM customexample " 1020 1021 "WHERE search > 0 ORDER BY rulename;"); 1021 query.exec();1022 1022 1023 if (query. isActive() && query.size())1023 if (query.exec()) 1024 1024 { 1025 1025 while (query.next()) 1026 1026 { … … 1317 1317 query.prepare("SELECT fromclause, whereclause FROM customexample " 1318 1318 "WHERE rulename = :RULENAME;"); 1319 1319 query.bindValue(":RULENAME", qphrase); 1320 query.exec();1321 1320 1322 if (query. isActive() && query.size())1321 if (query.exec() && query.next()) 1323 1322 { 1324 query.next();1325 1323 fromc = query.value(0).toString(); 1326 1324 wherec = query.value(1).toString(); 1327 1325 … … 1608 1606 MSqlQuery query(MSqlQuery::InitCon()); 1609 1607 query.prepare("DELETE FROM oldrecorded WHERE title = :TITLE ;"); 1610 1608 query.bindValue(":TITLE", pi->title); 1611 query.exec(); 1609 if (!query.exec()) 1610 MythDB::DBError("ProgLister::customEvent -- delete", 1611 query); 1612 1612 1613 1613 ScheduledRecording::signalChange(0); 1614 1614 fillItemList(false); … … 1777 1777 "WHERE phrase = :PHRASE AND searchtype = :TYPE;"); 1778 1778 query.bindValue(":PHRASE", qphrase); 1779 1779 query.bindValue(":TYPE", m_searchType); 1780 query.exec(); 1780 if (!query.exec()) 1781 MythDB::DBError("PhrasePopup::deleteClicked", query); 1781 1782 1782 1783 m_phraseList->RemoveItem(m_phraseList->GetItemCurrent()); 1783 1784 … … 2052 2053 "WHERE phrase = :PHRASE AND searchtype = :TYPE;"); 2053 2054 query.bindValue(":PHRASE", qphrase); 2054 2055 query.bindValue(":TYPE", m_searchType); 2055 query.exec(); 2056 if (!query.exec()) 2057 MythDB::DBError("PowerSearchPopup::deleteClicked", query); 2056 2058 2057 2059 m_phraseList->RemoveItem(m_phraseList->GetItemCurrent()); 2058 2060 … … 2235 2237 MSqlQuery query(MSqlQuery::InitCon()); 2236 2238 2237 2239 query.prepare("SELECT genre FROM programgenres GROUP BY genre;"); 2238 query.exec();2239 2240 2240 if (query. isActive() && query.size())2241 if (query.exec() && query.size()) 2241 2242 { 2242 2243 while (query.next()) 2243 2244 { -
programs/mythfrontend/statusbox.cpp
old new 387 387 query.prepare("UPDATE mythlog SET acknowledged = 1 " 388 388 "WHERE logid = :LOGID ;"); 389 389 query.bindValue(":LOGID", sql); 390 query.exec(); 390 if (!query.exec()) 391 MythDB::DBError("StatusBox::customEvent -- LogAck", query); 391 392 doLogEntries(); 392 393 } 393 394 } … … 399 400 query.prepare("UPDATE mythlog SET acknowledged = 1 " 400 401 "WHERE priority <= :PRIORITY ;"); 401 402 query.bindValue(":PRIORITY", m_minLevel); 402 query.exec(); 403 if (!query.exec()) 404 MythDB::DBError("StatusBox::customEvent -- LogAckAll", 405 query); 403 406 doLogEntries(); 404 407 } 405 408 } -
programs/mythshutdown/main.cpp
old new 57 57 query.prepare("SELECT data FROM settings WHERE value = :KEY AND " 58 58 "hostname IS NULL;"); 59 59 query.bindValue(":KEY", key); 60 query.exec(); 61 if (query.isActive() && query.size() > 0) 60 if (query.exec() && query.next()) 62 61 { 63 query.next();64 62 value = query.value(0).toString(); 65 63 } 66 64 } … … 96 94 } 97 95 98 96 // does the setting already exist? 99 query.exec("SELECT * FROM settings " 100 "WHERE value = 'MythShutdownLock' AND hostname IS NULL;"); 97 if (!query.exec("SELECT * FROM settings " 98 "WHERE value = 'MythShutdownLock' AND hostname IS NULL;")) 99 MythDB::DBError("lockShutdown -- select", query); 101 100 102 101 if (query.size() < 1) 103 102 { 104 103 // add the lock setting 105 query.exec("INSERT INTO settings (value, data) " 106 "VALUES ('MythShutdownLock', '1');"); 104 if (!query.exec("INSERT INTO settings (value, data) " 105 "VALUES ('MythShutdownLock', '1');")) 106 MythDB::DBError("lockShutdown -- insert", query); 107 107 } 108 108 else 109 109 { 110 110 // update the lock setting 111 query.exec("UPDATE settings SET data = data + 1 " 112 "WHERE value = 'MythShutdownLock' AND hostname IS NULL;"); 111 if (!query.exec("UPDATE settings SET data = data + 1 " 112 "WHERE value = 'MythShutdownLock' " 113 "AND hostname IS NULL;")) 114 MythDB::DBError("lockShutdown -- update", query); 113 115 } 114 116 115 117 // unlock settings table 116 query.exec("UNLOCK TABLES;"); 118 if (!query.exec("UNLOCK TABLES;")) 119 MythDB::DBError("lockShutdown -- unlock", query); 117 120 118 121 return 0; 119 122 } … … 140 143 } 141 144 142 145 // does the setting exist? 143 query.exec("SELECT * FROM settings " 144 "WHERE value = 'MythShutdownLock' AND hostname IS NULL;"); 146 if (!query.exec("SELECT * FROM settings " 147 "WHERE value = 'MythShutdownLock' AND hostname IS NULL;")) 148 MythDB::DBError("unlockShutdown -- select", query); 145 149 146 150 if (query.size() < 1) 147 151 { 148 152 // add the lock setting 149 query.exec("INSERT INTO settings (value, data) " 150 "VALUES ('MythShutdownLock', '0');"); 153 if (!query.exec("INSERT INTO settings (value, data) " 154 "VALUES ('MythShutdownLock', '0');")) 155 MythDB::DBError("unlockShutdown -- insert", query); 151 156 } 152 157 else 153 158 { 154 159 // update lock setting 155 query.exec("UPDATE settings SET data = GREATEST(0, data - 1) " 156 "WHERE value = 'MythShutdownLock' AND hostname IS NULL;"); 160 if (!query.exec("UPDATE settings SET data = GREATEST(0, data - 1) " 161 "WHERE value = 'MythShutdownLock' " 162 "AND hostname IS NULL;")) 163 MythDB::DBError("unlockShutdown -- update", query); 157 164 } 158 165 159 166 // unlock table 160 query.exec("UNLOCK TABLES;"); 167 if (!query.exec("UNLOCK TABLES;")) 168 MythDB::DBError("unlockShutdown -- unlock", query); 161 169 162 170 // tell the master BE to reset its idle time 163 171 RemoteSendMessage("RESET_IDLETIME"); -
programs/mythfilldatabase/icondata.cpp
old new 288 288 qc.prepare("SELECT COUNT(*) FROM settings " 289 289 "WHERE value = :STUBNAME"); 290 290 qc.bindValue(":STUBNAME", st); 291 qc.exec(); 292 if (qc.isActive() && qc.size() > 0) 291 if (qc.exec() && qc.next()) 293 292 { 294 qc.first();295 293 if (qc.value(0).toInt() != 0) 296 294 { 297 295 qr = &su_query; … … 350 348 QDomElement roote = iconmap.createElement(IM_DOC_TAG); 351 349 352 350 MSqlQuery query(MSqlQuery::InitCon()); 353 query.exec("SELECT * FROM callsignnetworkmap ORDER BY callsign;");354 351 355 if (query. isActive() && query.size() > 0)352 if (query.exec("SELECT * FROM callsignnetworkmap ORDER BY callsign;")) 356 353 { 357 354 while (query.next()) 358 355 { … … 374 371 } 375 372 } 376 373 377 query.exec("SELECT * FROM networkiconmap ORDER BY network;"); 378 if (query.isActive() && query.size() > 0) 374 if (query.exec("SELECT * FROM networkiconmap ORDER BY network;")) 379 375 { 380 376 while (query.next()) 381 377 { … … 401 397 query.prepare("SELECT value,data FROM settings WHERE value " 402 398 "LIKE :URLMAP"); 403 399 query.bindValue(":URLMAP", QString(BASEURLMAP_START) + "%"); 404 query.exec(); 405 if (query.isActive() && query.size() > 0) 400 if (query.exec()) 406 401 { 407 402 QRegExp baseax("\\.([^\\.]+)$"); 408 403 while (query.next()) -
programs/mythbackend/main.cpp
old new 103 103 records_without_station.prepare("SELECT record.chanid," 104 104 " channel.callsign FROM record LEFT JOIN channel" 105 105 " ON record.chanid = channel.chanid WHERE record.station='';"); 106 records_without_station.exec(); 107 if (records_without_station.first()) 106 if (records_without_station.exec() && records_without_station.next()) 108 107 { 109 108 MSqlQuery update_record(MSqlQuery::InitCon()); 110 109 update_record.prepare("UPDATE record SET station = :CALLSIGN" -
programs/mythfilldatabase/main.cpp
old new 728 728 "with multiple parts."); 729 729 730 730 MSqlQuery sel(MSqlQuery::InitCon()); 731 sel.exec("SELECT DISTINCT programid, partnumber, parttotal " 732 "FROM program WHERE partnumber > 0 AND parttotal > 0 AND " 733 "programid LIKE '%0000'"); 734 735 if (sel.isActive() && sel.size() > 0) 731 if (sel.exec("SELECT DISTINCT programid, partnumber, parttotal " 732 "FROM program WHERE partnumber > 0 AND parttotal > 0 AND " 733 "programid LIKE '%0000'")) 736 734 { 737 735 MSqlQuery repl(MSqlQuery::InitCon()); 738 736 … … 814 812 if (grab_data) 815 813 { 816 814 MSqlQuery updt(MSqlQuery::InitCon()); 817 updt.exec("UPDATE program SET first = 0, last = 0;"); 815 if (!updt.exec("UPDATE program SET first = 0, last = 0;")) 816 MythDB::DBError("Clearing first and last showings", updt); 818 817 819 818 VERBOSE(VB_GENERAL, "Marking episode first showings."); 820 819 821 820 MSqlQuery query(MSqlQuery::InitCon()); 822 query.exec("SELECT MIN(starttime),programid FROM program " 823 "WHERE programid > '' GROUP BY programid;"); 824 825 if (query.isActive() && query.size() > 0) 821 if (query.exec("SELECT MIN(starttime),programid FROM program " 822 "WHERE programid > '' GROUP BY programid;")) 826 823 { 827 824 while(query.next()) 828 825 { … … 831 828 " AND programid = :PROGRAMID;"); 832 829 updt.bindValue(":STARTTIME", query.value(0).toDateTime()); 833 830 updt.bindValue(":PROGRAMID", query.value(1).toString()); 834 updt.exec(); 831 if (!updt.exec()) 832 MythDB::DBError("Marking first showings by id", updt); 835 833 } 836 834 } 837 835 int found = query.size(); 838 836 839 query.exec("SELECT MIN(starttime),title,subtitle,description " 840 "FROM program WHERE programid = '' " 841 "GROUP BY title,subtitle,description;"); 842 843 if (query.isActive() && query.size() > 0) 837 if (query.exec("SELECT MIN(starttime),title,subtitle,description " 838 "FROM program WHERE programid = '' " 839 "GROUP BY title,subtitle,description;")) 844 840 { 845 841 while(query.next()) 846 842 { … … 853 849 updt.bindValue(":TITLE", query.value(1).toString()); 854 850 updt.bindValue(":SUBTITLE", query.value(2).toString()); 855 851 updt.bindValue(":DESCRIPTION", query.value(3).toString()); 856 updt.exec(); 852 if (!updt.exec()) 853 MythDB::DBError("Marking first showings", updt); 857 854 } 858 855 } 859 856 found += query.size(); … … 861 858 862 859 VERBOSE(VB_GENERAL, "Marking episode last showings."); 863 860 864 query.exec("SELECT MAX(starttime),programid FROM program " 865 "WHERE programid > '' GROUP BY programid;"); 866 867 if (query.isActive() && query.size() > 0) 861 if (query.exec("SELECT MAX(starttime),programid FROM program " 862 "WHERE programid > '' GROUP BY programid;")) 868 863 { 869 864 while(query.next()) 870 865 { … … 873 868 " AND programid = :PROGRAMID;"); 874 869 updt.bindValue(":STARTTIME", query.value(0).toDateTime()); 875 870 updt.bindValue(":PROGRAMID", query.value(1).toString()); 876 updt.exec(); 871 if (!updt.exec()) 872 MythDB::DBError("Marking last showings by id", updt); 877 873 } 878 874 } 879 875 found = query.size(); 880 876 881 query.exec("SELECT MAX(starttime),title,subtitle,description " 882 "FROM program WHERE programid = '' " 883 "GROUP BY title,subtitle,description;"); 884 885 if (query.isActive() && query.size() > 0) 877 if (query.exec("SELECT MAX(starttime),title,subtitle,description " 878 "FROM program WHERE programid = '' " 879 "GROUP BY title,subtitle,description;")) 886 880 { 887 881 while(query.next()) 888 882 { … … 895 889 updt.bindValue(":TITLE", query.value(1).toString()); 896 890 updt.bindValue(":SUBTITLE", query.value(2).toString()); 897 891 updt.bindValue(":DESCRIPTION", query.value(3).toString()); 898 updt.exec(); 892 if (!updt.exec()) 893 MythDB::DBError("Marking last showings", updt); 899 894 } 900 895 } 901 896 found += query.size(); … … 905 900 if (1) // limit MSqlQuery's lifetime 906 901 { 907 902 MSqlQuery query(MSqlQuery::InitCon()); 908 query.exec( "SELECT count(previouslyshown) FROM program WHERE previouslyshown = 1;"); 909 if (query.isActive() && query.size() > 0) 903 if (query.exec( "SELECT count(previouslyshown) " 904 "FROM program WHERE previouslyshown = 1;") && 905 query.next()) 910 906 { 911 query.next();912 907 if (query.value(0).toInt() != 0) 913 query.exec("UPDATE settings SET data = '1' WHERE value = 'HaveRepeats';"); 908 if (!query.exec("UPDATE settings SET data = '1' " 909 "WHERE value = 'HaveRepeats';")) 910 MythDB::DBError("Setting HaveRepeats", query); 914 911 else 915 query.exec("UPDATE settings SET data = '0' WHERE value = 'HaveRepeats';"); 912 if (!query.exec("UPDATE settings SET data = '0' " 913 "WHERE value = 'HaveRepeats';")) 914 MythDB::DBError("Clearing HaveRepeats", query); 916 915 } 917 916 } 918 917 -
programs/mythbackend/mainserver.cpp
old new 1709 1709 "WHERE chanid = :CHANID AND starttime = :STARTTIME;"); 1710 1710 query.bindValue(":CHANID", ds->chanid); 1711 1711 query.bindValue(":STARTTIME", ds->recstartts); 1712 query.exec();1713 1712 1714 if (!query. isActive())1713 if (!query.exec()) 1715 1714 { 1716 1715 MythDB::DBError("Recorded program delete recordedmarkup", query); 1717 1716 gContext->LogEntry("mythbackend", LP_ERROR, "Delete Recording", … … 1723 1722 "WHERE chanid = :CHANID AND starttime = :STARTTIME;"); 1724 1723 query.bindValue(":CHANID", ds->chanid); 1725 1724 query.bindValue(":STARTTIME", ds->recstartts); 1726 query.exec();1727 1725 1728 if (!query. isActive())1726 if (!query.exec()) 1729 1727 { 1730 1728 MythDB::DBError("Recorded program delete recordedseek", query); 1731 1729 gContext->LogEntry("mythbackend", LP_ERROR, "Delete Recording", … … 2563 2561 } 2564 2562 query.prepare("DELETE FROM program WHERE manualid = :RECID;"); 2565 2563 query.bindValue(":RECID", recordid); 2566 query.exec(); 2564 if (!query.exec()) 2565 MythDB::DBError("MainServer::HandleGetPendingRecordings " 2566 "- delete", query); 2567 2567 } 2568 2568 } 2569 2569 } -
programs/mythbackend/scheduler.cpp
old new 382 382 MSqlQuery query(dbConn); 383 383 QString thequery; 384 384 QString where = ""; 385 bool ok; 385 386 386 387 // This will cause our temp copy of recordmatch to be empty 387 388 if (recordid == -1) … … 392 393 393 394 query.prepare(thequery); 394 395 recordmatchLock.lock(); 395 query.exec();396 ok = query.exec(); 396 397 recordmatchLock.unlock(); 397 if (! query.isActive())398 if (!ok) 398 399 { 399 400 MythDB::DBError("FillRecordListFromDB", query); 400 401 return; … … 402 403 403 404 thequery = "ALTER TABLE recordmatch ADD INDEX (recordid);"; 404 405 query.prepare(thequery); 405 query.exec(); 406 if (!query.isActive()) 406 if (!query.exec()) 407 407 { 408 408 MythDB::DBError("FillRecordListFromDB", query); 409 409 return; … … 423 423 424 424 MSqlQuery queryDrop(dbConn); 425 425 queryDrop.prepare("DROP TABLE recordmatch;"); 426 queryDrop.exec(); 427 if (!queryDrop.isActive()) 426 if (!queryDrop.exec()) 428 427 { 429 428 MythDB::DBError("FillRecordListFromDB", queryDrop); 430 429 return; … … 1351 1350 subquery.bindValue(":RECORDID", recid); 1352 1351 subquery.bindValue(":NEXTREC", nextRecMap[recid]); 1353 1352 } 1354 subquery.exec(); 1355 if (!subquery.isActive()) 1353 if (!subquery.exec()) 1356 1354 MythDB::DBError("Update next_record", subquery); 1357 1355 else 1358 1356 VERBOSE(VB_SCHEDULE, LOC + … … 1566 1564 " WHERE recstatus = :RSRECORDING"); 1567 1565 query.bindValue(":RSABORTED", rsAborted); 1568 1566 query.bindValue(":RSRECORDING", rsRecording); 1569 query.exec(); 1570 if (!query.isActive()) 1567 if (!query.exec()) 1571 1568 MythDB::DBError("UpdateAborted", query); 1572 1569 1573 1570 // wait for slaves to connect … … 2294 2291 query.prepare("SELECT DISTINCT hostname, recusage FROM inuseprograms " 2295 2292 "WHERE lastupdatetime > :ONEHOURAGO ;"); 2296 2293 query.bindValue(":ONEHOURAGO", oneHourAgo); 2297 if (query.exec() && query.isActive() && query.size() > 0)2294 if (query.exec()) 2298 2295 { 2299 2296 while(query.next()) { 2300 2297 SlavesInUse << query.value(0).toString(); … … 2468 2465 " enddate,endtime " 2469 2466 "FROM %1 WHERE recordid = :RECORDID").arg(recordTable)); 2470 2467 query.bindValue(":RECORDID", recordid); 2471 query.exec(); 2472 if (!query.isActive() || query.size() != 1) 2468 if (!query.exec() || query.size() != 1) 2473 2469 { 2474 2470 MythDB::DBError("UpdateManuals", query); 2475 2471 return; … … 2487 2483 query.prepare("SELECT chanid from channel " 2488 2484 "WHERE callsign = :STATION"); 2489 2485 query.bindValue(":STATION", station); 2490 query.exec(); 2491 if (!query.isActive()) 2486 if (!query.exec()) 2492 2487 { 2493 2488 MythDB::DBError("UpdateManuals", query); 2494 2489 return; … … 2551 2546 query.bindValue(":TITLE", title); 2552 2547 query.bindValue(":SUBTITLE", startdt.toString()); 2553 2548 query.bindValue(":RECORDID", recordid); 2554 query.exec(); 2555 if (!query.isActive()) 2549 if (!query.exec()) 2556 2550 { 2557 2551 MythDB::DBError("UpdateManuals", query); 2558 2552 return; … … 2703 2697 query.bindValue(":RECORDID", recordid); 2704 2698 } 2705 2699 2706 query.exec(); 2707 if (!query.isActive()) 2700 if (!query.exec()) 2708 2701 { 2709 2702 MythDB::DBError("UpdateMatches", query); 2710 2703 return; … … 2717 2710 query.prepare("DELETE FROM program WHERE manualid = :RECORDID"); 2718 2711 query.bindValue(":RECORDID", recordid); 2719 2712 } 2720 query.exec(); 2721 if (!query.isActive()) 2713 if (!query.exec()) 2722 2714 { 2723 2715 MythDB::DBError("UpdateMatches", query); 2724 2716 return; … … 2728 2720 query.prepare("SELECT NULL from record " 2729 2721 "WHERE type = :FINDONE AND findid <= 0;"); 2730 2722 query.bindValue(":FINDONE", kFindOneRecord); 2731 query.exec(); 2732 if (!query.isActive()) 2723 if (!query.exec()) 2733 2724 { 2734 2725 MythDB::DBError("UpdateMatches", query); 2735 2726 return; … … 2742 2733 "WHERE type = :FINDONE AND findid <= 0;"); 2743 2734 query.bindValue(":FINDID", findtoday); 2744 2735 query.bindValue(":FINDONE", kFindOneRecord); 2745 query.exec(); 2736 if (!query.exec()) 2737 MythDB::DBError("UpdateMatches", query); 2746 2738 } 2747 2739 2748 2740 int clause; … … 2831 2823 result.bindValue(it.key(), it.value()); 2832 2824 } 2833 2825 2834 result.exec();2826 bool ok = result.exec(); 2835 2827 gettimeofday(&dbend, NULL); 2836 2828 2837 if (! result.isActive())2829 if (!ok) 2838 2830 { 2839 2831 MythDB::DBError("UpdateMatches3", result); 2840 2832 continue; … … 2873 2865 MSqlQuery rlist(dbConn); 2874 2866 rlist.prepare(QString("SELECT recordid,title,maxepisodes,maxnewest FROM %1;").arg(recordTable)); 2875 2867 2876 rlist.exec(); 2877 2878 if (!rlist.isActive()) 2868 if (!rlist.exec()) 2879 2869 { 2880 2870 MythDB::DBError("CheckTooMany", rlist); 2881 2871 return; … … 2941 2931 schedTmpRecord = "sched_temp_record"; 2942 2932 2943 2933 result.prepare("DROP TABLE IF EXISTS sched_temp_record;"); 2944 result.exec();2945 2934 2946 if (!result. isActive())2935 if (!result.exec()) 2947 2936 { 2948 2937 MythDB::DBError("Dropping sched_temp_record table", result); 2949 2938 return; … … 2951 2940 2952 2941 result.prepare("CREATE TEMPORARY TABLE sched_temp_record " 2953 2942 "LIKE record;"); 2954 result.exec();2955 2943 2956 if (!result. isActive())2944 if (!result.exec()) 2957 2945 { 2958 2946 MythDB::DBError("Creating sched_temp_record table", 2959 2947 result); … … 2961 2949 } 2962 2950 2963 2951 result.prepare("INSERT sched_temp_record SELECT * from record;"); 2964 result.exec();2965 2952 2966 if (!result. isActive())2953 if (!result.exec()) 2967 2954 { 2968 2955 MythDB::DBError("Populating sched_temp_record table", 2969 2956 result); … … 2972 2959 } 2973 2960 2974 2961 result.prepare("DROP TABLE IF EXISTS sched_temp_recorded;"); 2975 result.exec();2976 2962 2977 if (!result. isActive())2963 if (!result.exec()) 2978 2964 { 2979 2965 MythDB::DBError("Dropping sched_temp_recorded table", result); 2980 2966 return; … … 2982 2968 2983 2969 result.prepare("CREATE TEMPORARY TABLE sched_temp_recorded " 2984 2970 "LIKE recorded;"); 2985 result.exec();2986 2971 2987 if (!result. isActive())2972 if (!result.exec()) 2988 2973 { 2989 2974 MythDB::DBError("Creating sched_temp_recorded table", result); 2990 2975 return; 2991 2976 } 2992 2977 2993 2978 result.prepare("INSERT sched_temp_recorded SELECT * from recorded;"); 2994 result.exec();2995 2979 2996 if (!result. isActive())2980 if (!result.exec()) 2997 2981 { 2998 2982 MythDB::DBError("Populating sched_temp_recorded table", result); 2999 2983 return; … … 3001 2985 3002 2986 result.prepare(QString("SELECT recpriority, selectclause FROM %1;") 3003 2987 .arg(priorityTable)); 3004 result.exec();3005 2988 3006 if (!result. isActive())2989 if (!result.exec()) 3007 2990 { 3008 2991 MythDB::DBError("Power Priority", result); 3009 2992 return; … … 3164 3147 3165 3148 gettimeofday(&dbstart, NULL); 3166 3149 result.prepare(rmquery); 3167 result.exec(); 3168 if (!result.isActive()) 3150 if (!result.exec()) 3169 3151 { 3170 3152 MythDB::DBError("AddNewRecords recordmatch", result); 3171 3153 return; 3172 3154 } 3173 3155 result.prepare(query); 3174 result.exec(); 3175 if (!result.isActive()) 3156 if (!result.exec()) 3176 3157 { 3177 3158 MythDB::DBError("AddNewRecords", result); 3178 3159 return; … … 3353 3334 if (schedTmpRecord == "sched_temp_record") 3354 3335 { 3355 3336 result.prepare("DROP TABLE IF EXISTS sched_temp_record;"); 3356 result.exec(); 3337 if (!result.exec()) 3338 MythDB::DBError("AddNewRecords sched_temp_record", query); 3357 3339 } 3358 3340 3359 3341 result.prepare("DROP TABLE IF EXISTS sched_temp_recorded;"); 3360 result.exec(); 3342 if (!result.exec()) 3343 MythDB::DBError("AddNewRecords drop table", query); 3361 3344 } 3362 3345 3363 3346 void Scheduler::AddNotListed(void) { … … 3393 3376 gettimeofday(&dbstart, NULL); 3394 3377 MSqlQuery result(dbConn); 3395 3378 result.prepare(query); 3396 result.exec();3379 bool ok = result.exec(); 3397 3380 gettimeofday(&dbend, NULL); 3398 3381 3399 if (! result.isActive())3382 if (!ok) 3400 3383 { 3401 3384 MythDB::DBError("AddNotListed", result); 3402 3385 return; … … 3511 3494 3512 3495 MSqlQuery result(MSqlQuery::InitCon()); 3513 3496 result.prepare(query); 3514 result.exec();3515 3497 3516 if (!result. isActive())3498 if (!result.exec()) 3517 3499 { 3518 3500 MythDB::DBError("findAllScheduledPrograms", result); 3519 3501 return; -
programs/mythbackend/housekeeper.cpp
old new 100 100 result.prepare("INSERT INTO housekeeping(tag,lastrun) " 101 101 "values(:TAG ,now());"); 102 102 result.bindValue(":TAG", dbTag); 103 result.exec(); 103 if (!result.exec()) 104 MythDB::DBError("HouseKeeper::wantToRun -- insert", result); 104 105 105 106 runOK = true; 106 107 } … … 116 117 { 117 118 result.prepare("DELETE FROM housekeeping WHERE tag = :TAG ;"); 118 119 result.bindValue(":TAG", dbTag); 119 result.exec(); 120 if (!result.exec()) 121 MythDB::DBError("HouseKeeper::updateLastrun -- delete", result); 120 122 121 123 result.prepare("INSERT INTO housekeeping(tag,lastrun) " 122 124 "values(:TAG ,now()) ;"); 123 125 result.bindValue(":TAG", dbTag); 124 result.exec(); 126 if (!result.exec()) 127 MythDB::DBError("HouseKeeper::updateLastrun -- insert", result); 125 128 } 126 129 } 127 130 … … 285 288 result.prepare("DELETE FROM mythlog WHERE " 286 289 "acknowledged=1 and logdate < :DAYS ;"); 287 290 result.bindValue(":DAYS", days); 288 result.exec(); 291 if (!result.exec()) 292 MythDB::DBError("HouseKeeper::flushLogs -- delete acknowledged", 293 result); 289 294 290 295 result.prepare("DELETE FROM mythlog WHERE logdate< :MAX ;"); 291 296 result.bindValue(":MAX", max); 292 result.exec(); 297 if (!result.exec()) 298 MythDB::DBError("HouseKeeper::flushLogs -- delete old", 299 result); 293 300 } 294 301 } 295 302 … … 369 376 "WHERE hostname = :HOSTNAME AND " 370 377 "( recusage = 'recorder' OR recusage LIKE 'Unknown %' );"); 371 378 query.bindValue(":HOSTNAME", gContext->GetHostName()); 372 query.exec(); 379 if (!query.exec()) 380 MythDB::DBError("HouseKeeper::CleanupMyOldRecordings", query); 373 381 } 374 382 375 383 void HouseKeeper::CleanupAllOldInUsePrograms(void) … … 380 388 query.prepare("DELETE FROM inuseprograms " 381 389 "WHERE lastupdatetime < :FOURHOURSAGO ;"); 382 390 query.bindValue(":FOURHOURSAGO", fourHoursAgo); 383 query.exec(); 391 if (!query.exec()) 392 MythDB::DBError("HouseKeeper::CleanupAllOldInUsePrograms", query); 384 393 } 385 394 386 395 void HouseKeeper::CleanupOrphanedLivetvChains(void) … … 416 425 .arg(keepChains); 417 426 } 418 427 deleteQuery.prepare(msg); 419 deleteQuery.exec(); 428 if (!deleteQuery.exec()) 429 MythDB::DBError("HouseKeeper Cleaning TVChain Table", deleteQuery); 420 430 } 421 431 422 432 void HouseKeeper::CleanupRecordedTables(void) … … 494 504 { 495 505 deleteQuery.bindValue(":CHANID", query.value(0).toString()); 496 506 deleteQuery.bindValue(":STARTTIME", query.value(1).toString()); 497 deleteQuery.exec(); 507 if (!deleteQuery.exec()) 508 MythDB::DBError("HouseKeeper Cleaning Recorded Tables", 509 deleteQuery); 498 510 } 499 511 500 512 tableIndex++; … … 517 529 518 530 query.prepare("DELETE FROM oldprogram WHERE airdate < " 519 531 "DATE_SUB(CURRENT_DATE, INTERVAL 320 DAY);"); 520 query.exec(); 532 if (!query.exec()) 533 MythDB::DBError("HouseKeeper Cleaning Program Listings", query); 521 534 522 535 query.prepare("REPLACE INTO oldprogram (oldtitle,airdate) " 523 536 "SELECT title,starttime FROM program " 524 537 "WHERE starttime < NOW() AND manualid = 0 " 525 538 "GROUP BY title;"); 526 query.exec(); 539 if (!query.exec()) 540 MythDB::DBError("HouseKeeper Cleaning Program Listings", query); 527 541 528 542 query.prepare("DELETE FROM program WHERE starttime <= " 529 543 "DATE_SUB(CURRENT_DATE, INTERVAL :OFFSET DAY);"); 530 544 query.bindValue(":OFFSET", offset); 531 query.exec(); 545 if (!query.exec()) 546 MythDB::DBError("HouseKeeper Cleaning Program Listings", query); 532 547 533 548 query.prepare("DELETE FROM programrating WHERE starttime <= " 534 549 "DATE_SUB(CURRENT_DATE, INTERVAL :OFFSET DAY);"); 535 550 query.bindValue(":OFFSET", offset); 536 query.exec(); 551 if (!query.exec()) 552 MythDB::DBError("HouseKeeper Cleaning Program Listings", query); 537 553 538 554 query.prepare("DELETE FROM programgenres WHERE starttime <= " 539 555 "DATE_SUB(CURRENT_DATE, INTERVAL :OFFSET DAY);"); 540 556 query.bindValue(":OFFSET", offset); 541 query.exec(); 557 if (!query.exec()) 558 MythDB::DBError("HouseKeeper Cleaning Program Listings", query); 542 559 543 560 query.prepare("DELETE FROM credits WHERE starttime <= " 544 561 "DATE_SUB(CURRENT_DATE, INTERVAL :OFFSET DAY);"); 545 562 query.bindValue(":OFFSET", offset); 546 query.exec(); 563 if (!query.exec()) 564 MythDB::DBError("HouseKeeper Cleaning Program Listings", query); 547 565 548 566 query.prepare("DELETE FROM record WHERE (type = :SINGLE " 549 567 "OR type = :OVERRIDE OR type = :DONTRECORD) " … … 551 569 query.bindValue(":SINGLE", kSingleRecord); 552 570 query.bindValue(":OVERRIDE", kOverrideRecord); 553 571 query.bindValue(":DONTRECORD", kDontRecord); 554 query.exec(); 572 if (!query.exec()) 573 MythDB::DBError("HouseKeeper Cleaning Program Listings", query); 555 574 556 575 MSqlQuery findq(MSqlQuery::InitCon()); 557 576 findq.prepare("SELECT record.recordid FROM record " 558 577 "LEFT JOIN oldfind ON oldfind.recordid = record.recordid " 559 578 "WHERE type = :FINDONE AND oldfind.findid IS NOT NULL;"); 560 579 findq.bindValue(":FINDONE", kFindOneRecord); 561 findq.exec();562 580 563 if (findq. isActive() && findq.size() > 0)581 if (findq.exec()) 564 582 { 565 583 while (findq.next()) 566 584 { 567 585 query.prepare("DELETE FROM record WHERE recordid = :RECORDID;"); 568 586 query.bindValue(":RECORDID", findq.value(0).toInt()); 569 query.exec(); 587 if (!query.exec()) 588 MythDB::DBError("HouseKeeper Cleaning Program Listings", query); 570 589 } 571 590 } 572 591 query.prepare("DELETE FROM oldfind WHERE findid < TO_DAYS(NOW()) - 14;"); 573 query.exec(); 592 if (!query.exec()) 593 MythDB::DBError("HouseKeeper Cleaning Program Listings", query); 574 594 575 595 int cleanOldRecorded = gContext->GetNumSetting( "CleanOldRecorded", 10); 576 596 … … 579 599 "endtime < DATE_SUB(CURRENT_DATE, INTERVAL :CLEAN DAY);"); 580 600 query.bindValue(":RECORDED", rsRecorded); 581 601 query.bindValue(":CLEAN", cleanOldRecorded); 582 query.exec(); 602 if (!query.exec()) 603 MythDB::DBError("HouseKeeper Cleaning Program Listings", query); 583 604 584 605 } 585 606 -
programs/mythbackend/backendutil.cpp
old new 16 16 #include "remoteutil.h" 17 17 18 18 #include "mythcontext.h" 19 #include "mythdb.h" 19 20 #include "mythdbcon.h" 20 21 #include "util.h" 21 22 #include "decodeencode.h" … … 92 93 "WHERE groupname = :GROUP " 93 94 "GROUP BY dirname;"); 94 95 query.bindValue(":GROUP", "Default"); 95 query.exec(); 96 if (!query.exec()) 97 MythDB::DBError("BackendQueryDiskSpace", query); 96 98 } 97 99 98 100 QDir checkDir(""); -
programs/mythbackend/upnpcdsvideo.cpp
old new 203 203 "AND parentid = :ROOTID"); 204 204 205 205 query.bindValue(":ROOTID", STARTING_VIDEO_OBJECTID); 206 query.exec();207 206 208 if (query. size() > 0)207 if (query.exec() && query.next()) 209 208 { 210 query.next();211 209 nCount = query.value(0).toInt(); 212 210 } 213 211 … … 252 250 if (query.isConnected()) 253 251 { 254 252 BuildItemQuery( query, mapParams ); 255 query.exec(); 256 257 if (query.isActive() && query.size() > 0) 253 254 if (query.exec() && query.next()) 258 255 { 259 if ( query.next() ) 260 { 261 AddItem( pRequest->m_sParentId, pResults, false, query ); 262 pResults->m_nTotalMatches = 1; 263 } 256 AddItem( pRequest->m_sParentId, pResults, false, query ); 257 pResults->m_nTotalMatches = 1; 264 258 } 265 259 } 266 260 … … 366 360 //VERBOSE(VB_UPNP, QString("sSQL = %1").arg(sSQL)); 367 361 if ( sKey.length() ) 368 362 query.bindValue(":KEY", sKey ); 369 query.exec();370 363 371 if (query. isActive() && query.size() > 0)364 if (query.exec()) 372 365 { 373 366 while(query.next()) 374 367 AddItem( pRequest->m_sObjectId, pResults, bAddRef, query ); -
programs/mythtranscode/main.cpp
old new 979 979 "AND starttime = :STARTTIME "); 980 980 query.bindValue(":CHANID", pginfo->chanid); 981 981 query.bindValue(":STARTTIME", pginfo->recstartts); 982 query.exec();983 982 984 if (!query. isActive())983 if (!query.exec()) 985 984 MythDB::DBError("Error in mythtranscode", query); 986 985 987 986 query.prepare("UPDATE recorded " … … 993 992 query.bindValue(":WATCHED", "0"); 994 993 query.bindValue(":CHANID", pginfo->chanid); 995 994 query.bindValue(":STARTTIME", pginfo->recstartts); 996 query.exec();997 995 998 if (!query. isActive())996 if (!query.exec()) 999 997 MythDB::DBError("Error in mythtranscode", query); 1000 998 1001 999 pginfo->SetCommFlagged(COMM_FLAG_NOT_FLAGGED); … … 1015 1013 query.bindValue(":BOOKMARK", MARK_BOOKMARK); 1016 1014 query.bindValue(":CUTLIST_START", MARK_CUT_START); 1017 1015 query.bindValue(":CUTLIST_END", MARK_CUT_END); 1018 query.exec();1019 1016 1020 if (!query. isActive())1017 if (!query.exec()) 1021 1018 MythDB::DBError("Error in mythtranscode", query); 1022 1019 } 1023 1020 -
programs/mythbackend/upnpmedia.cpp
old new 100 100 QString sSQL = "SELECT filename, title, coverfile FROM videometadata"; 101 101 102 102 query.prepare ( sSQL ); 103 query.exec();104 103 105 if (query. isActive() && query.size() > 0)104 if (query.exec()) 106 105 { 107 106 while(query.next()) 108 107 { … … 166 165 query.bindValue(":TITLE", GetTitleName(fPath,fName)); 167 166 query.bindValue(":COVERART", GetCoverArt(fPath)); 168 167 169 query.exec(); 168 if (!query.exec()) 169 MythDB::DBError("UPnpMedia::buildFileList", query); 170 170 171 171 itemID = buildFileList(Info.filePath(), 0, itemID, query); 172 172 continue; … … 209 209 query.bindValue(":TITLE", GetTitleName(fPath,fName)); 210 210 query.bindValue(":COVERART", GetCoverArt(fPath)); 211 211 212 query.exec(); 212 if (!query.exec()) 213 MythDB::DBError("UPnpMedia::buildFileList", query); 213 214 214 215 } 215 216 }