Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
  • Loading branch information...
commit 3d42de592136a7f3ab9bfca197c73aaa5f6bc56d 1 parent 25eb5b3
@sphery sphery authored
View
4 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);
View
8 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)
View
6 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
View
8 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);
}
View
14 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 + '%';
View
4 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;
Please sign in to comment.
Something went wrong with that request. Please try again.