summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael T. Dean <mdean@mythtv.org>2011-08-26 23:19:06 (GMT)
committer Michael T. Dean <mdean@mythtv.org>2011-08-26 23:19:06 (GMT)
commit3d42de592136a7f3ab9bfca197c73aaa5f6bc56d (patch)
tree56b59d0f5b9a1ac03cea1c88708216314694343e
parent25eb5b373c2503db1bb5c1e1d86c284363706034 (diff)
Fix invalid-string-format date passing to MySQL.
This fixes a lot of instances where we were passing incorrectly-formatted string representations of date/time values in prepared queries. This is an issue now that MySQL 5.5 is picky about receiving properly-formatted strings. Thanks to Daniel K for finding another pattern to search for direct binding of string-formatted dates. Refs #8585.
-rw-r--r--mythtv/libs/libmythtv/recordinginfo.cpp4
-rw-r--r--mythtv/libs/libmythtv/tvbrowsehelper.cpp8
-rw-r--r--mythtv/programs/mythbackend/services/guide.cpp6
-rw-r--r--mythtv/programs/mythfrontend/guidegrid.cpp8
-rw-r--r--mythtv/programs/mythfrontend/progfind.cpp14
-rw-r--r--mythtv/programs/mythfrontend/proglist.cpp4
6 files changed, 22 insertions, 22 deletions
diff --git a/mythtv/libs/libmythtv/recordinginfo.cpp b/mythtv/libs/libmythtv/recordinginfo.cpp
index 7db1839..2717641 100644
--- a/mythtv/libs/libmythtv/recordinginfo.cpp
+++ b/mythtv/libs/libmythtv/recordinginfo.cpp
@@ -243,7 +243,7 @@ RecordingInfo::RecordingInfo(
" program.starttime < :STARTTS1 AND "
" program.endtime > :STARTTS2 ";
bindings[":CHANID"] = QString::number(_chanid);
- QString str_startts = desiredts.toString("yyyy-MM-ddThh:mm:50");
+ QString str_startts = desiredts.toString("yyyy-MM-dd hh:mm:50");
bindings[":STARTTS1"] = str_startts;
bindings[":STARTTS2"] = str_startts;
@@ -339,7 +339,7 @@ RecordingInfo::RecordingInfo(
" program.starttime > :STARTTS "
"GROUP BY program.starttime ORDER BY program.starttime LIMIT 1 ";
bindings[":CHANID"] = QString::number(_chanid);
- bindings[":STARTTS"] = desiredts.toString("yyyy-MM-ddThh:mm:50");
+ bindings[":STARTTS"] = desiredts.toString("yyyy-MM-dd hh:mm:50");
LoadFromProgram(progList, querystr, bindings, schedList, false);
diff --git a/mythtv/libs/libmythtv/tvbrowsehelper.cpp b/mythtv/libs/libmythtv/tvbrowsehelper.cpp
index a820f8e..dd5bcea 100644
--- a/mythtv/libs/libmythtv/tvbrowsehelper.cpp
+++ b/mythtv/libs/libmythtv/tvbrowsehelper.cpp
@@ -368,10 +368,10 @@ void TVBrowseHelper::GetNextProgramDB(
MSqlBindings bindings;
bindings[":CHANID"] = chanid;
- bindings[":NOWTS"] = nowtime.toString("yyyy-MM-ddThh:mm:ss");
- bindings[":LATESTTS"] = latesttime.toString("yyyy-MM-ddThh:mm:ss");
- bindings[":BROWSETS"] = browsetime.toString("yyyy-MM-ddThh:mm:ss");
- bindings[":BROWSETS2"] = browsetime.toString("yyyy-MM-ddThh:mm:ss");
+ bindings[":NOWTS"] = nowtime;
+ bindings[":LATESTTS"] = latesttime;
+ bindings[":BROWSETS"] = browsetime;
+ bindings[":BROWSETS2"] = browsetime;
QString querystr = " WHERE program.chanid = :CHANID ";
switch (direction)
diff --git a/mythtv/programs/mythbackend/services/guide.cpp b/mythtv/programs/mythbackend/services/guide.cpp
index 4601040..68942de 100644
--- a/mythtv/programs/mythbackend/services/guide.cpp
+++ b/mythtv/programs/mythbackend/services/guide.cpp
@@ -97,8 +97,8 @@ DTC::ProgramGuide *Guide::GetProgramGuide( const QDateTime &dtStartTime ,
bindings[":StartChanId"] = nStartChanId;
bindings[":EndChanId" ] = nEndChanId;
- bindings[":StartDate" ] = dtStartTime.toString( Qt::ISODate );
- bindings[":EndDate" ] = dtEndTime.toString( Qt::ISODate );
+ bindings[":StartDate" ] = dtStartTime;
+ bindings[":EndDate" ] = dtEndTime;
// ----------------------------------------------------------------------
// Get all Pending Scheduled Programs
@@ -182,7 +182,7 @@ DTC::Program* Guide::GetProgramDetails( int nChanId,
"AND program.starttime = :StartTime ";
bindings[":ChanId" ] = nChanId;
- bindings[":StartTime"] = dtStartTime.toString( Qt::ISODate );
+ bindings[":StartTime"] = dtStartTime;
// Get all Pending Scheduled Programs
diff --git a/mythtv/programs/mythfrontend/guidegrid.cpp b/mythtv/programs/mythfrontend/guidegrid.cpp
index 4239bd1..19dff90 100644
--- a/mythtv/programs/mythfrontend/guidegrid.cpp
+++ b/mythtv/programs/mythfrontend/guidegrid.cpp
@@ -670,8 +670,8 @@ ProgramList GuideGrid::GetProgramList(uint chanid) const
" program.endtime >= :STARTTS AND "
" program.starttime <= :ENDTS AND "
" program.manualid = 0 ";
- bindings[":STARTTS"] = m_currentStartTime.toString("yyyy-MM-ddThh:mm:00");
- bindings[":ENDTS"] = m_currentEndTime.toString("yyyy-MM-ddThh:mm:00");
+ bindings[":STARTTS"] = m_currentStartTime.toString("yyyy-MM-dd hh:mm:00");
+ bindings[":ENDTS"] = m_currentEndTime.toString("yyyy-MM-dd hh:mm:00");
bindings[":CHANID"] = chanid;
ProgramList dummy;
@@ -1046,8 +1046,8 @@ ProgramList *GuideGrid::getProgramListFromProgram(int chanNum)
" AND program.starttime <= :ENDTS "
" AND program.manualid = 0 ";
bindings[":CHANID"] = GetChannelInfo(chanNum)->chanid;
- bindings[":STARTTS"] = m_currentStartTime.toString("yyyy-MM-ddThh:mm:00");
- bindings[":ENDTS"] = m_currentEndTime.toString("yyyy-MM-ddThh:mm:00");
+ bindings[":STARTTS"] = m_currentStartTime.toString("yyyy-MM-dd hh:mm:00");
+ bindings[":ENDTS"] = m_currentEndTime.toString("yyyy-MM-dd hh:mm:00");
LoadFromProgram(*proglist, querystr, bindings, m_recList, false);
}
diff --git a/mythtv/programs/mythfrontend/progfind.cpp b/mythtv/programs/mythfrontend/progfind.cpp
index 439f728..810a596 100644
--- a/mythtv/programs/mythfrontend/progfind.cpp
+++ b/mythtv/programs/mythfrontend/progfind.cpp
@@ -575,7 +575,7 @@ void ProgFinder::selectShowData(QString progTitle, int newCurShow)
" AND program.endtime > :ENDTIME "
" AND channel.visible = 1 ";
bindings[":TITLE"] = progTitle;
- bindings[":ENDTIME"] = progStart.toString("yyyy-MM-ddThh:mm:50");
+ bindings[":ENDTIME"] = progStart.toString("yyyy-MM-dd hh:mm:50");
LoadFromScheduler(m_schedList);
LoadFromProgram(m_showData, querystr, bindings, m_schedList, false);
@@ -624,7 +624,7 @@ void ProgFinder::whereClauseGetSearchData(QString &where, MSqlBindings &bindings
where += "ORDER BY title;";
- bindings[":STARTTIME"] = progStart.toString("yyyy-MM-ddThh:mm:50");
+ bindings[":STARTTIME"] = progStart.toString("yyyy-MM-dd hh:mm:50");
}
else
{
@@ -649,7 +649,7 @@ void ProgFinder::whereClauseGetSearchData(QString &where, MSqlBindings &bindings
bindings[":TWO"] = two;
bindings[":THREE"] = three;
bindings[":FOUR"] = four;
- bindings[":STARTTIME"] = progStart.toString("yyyy-MM-ddThh:mm:50");
+ bindings[":STARTTIME"] = progStart.toString("yyyy-MM-dd hh:mm:50");
if (!m_searchStr.isEmpty())
bindings[":SEARCH"] = '%' + m_searchStr + '%';
@@ -844,7 +844,7 @@ void JaProgFinder::whereClauseGetSearchData(QString &where, MSqlBindings &bindin
where += "ORDER BY title_pronounce;";
- bindings[":STARTTIME"] = progStart.toString("yyyy-MM-ddThh:mm:50");
+ bindings[":STARTTIME"] = progStart.toString("yyyy-MM-dd hh:mm:50");
}
@@ -930,7 +930,7 @@ void HeProgFinder::whereClauseGetSearchData(QString &where, MSqlBindings &bindin
where += "ORDER BY title;";
- bindings[":STARTTIME"] = progStart.toString("yyyy-MM-ddThh:mm:50");
+ bindings[":STARTTIME"] = progStart.toString("yyyy-MM-dd hh:mm:50");
}
bool HeProgFinder::formatSelectedData(QString& data)
@@ -1012,7 +1012,7 @@ void RuProgFinder::whereClauseGetSearchData(QString &where, MSqlBindings
where += "ORDER BY title;";
- bindings[":STARTTIME"] = progStart.toString("yyyy-MM-ddThh:mm:50");
+ bindings[":STARTTIME"] = progStart.toString("yyyy-MM-dd hh:mm:50");
}
else
{
@@ -1040,7 +1040,7 @@ void RuProgFinder::whereClauseGetSearchData(QString &where, MSqlBindings
bindings[":THREE"] = three;
bindings[":FOUR"] = four;
bindings[":FIVE"] = five;
- bindings[":STARTTIME"] = progStart.toString("yyyy-MM-ddThh:mm:50");
+ bindings[":STARTTIME"] = progStart.toString("yyyy-MM-dd hh:mm:50");
if (!m_searchStr.isEmpty())
bindings[":SEARCH"] = '%' + m_searchStr + '%';
diff --git a/mythtv/programs/mythfrontend/proglist.cpp b/mythtv/programs/mythfrontend/proglist.cpp
index d8320e3..2f88695 100644
--- a/mythtv/programs/mythfrontend/proglist.cpp
+++ b/mythtv/programs/mythfrontend/proglist.cpp
@@ -796,7 +796,7 @@ void ProgLister::FillViewList(const QString &view)
}
else if (m_type == plCategory) // list by category
{
- QString startstr = m_startTime.toString("yyyy-MM-ddThh:mm:50");
+ QString startstr = m_startTime.toString("yyyy-MM-dd hh:mm:50");
MSqlQuery query(MSqlQuery::InitCon());
query.prepare("SELECT g1.genre, g2.genre "
"FROM program "
@@ -1130,7 +1130,7 @@ void ProgLister::FillItemList(bool restorePosition, bool updateDisp)
bool oneChanid = false;
QString where;
- QString startstr = m_startTime.toString("yyyy-MM-ddThh:mm:50");
+ QString startstr = m_startTime.toString("yyyy-MM-dd hh:mm:50");
QString qphrase = m_viewList[m_curView];
MSqlBindings bindings;