summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael T. Dean <mdean@mythtv.org>2011-03-02 19:59:51 (GMT)
committer Michael T. Dean <mdean@mythtv.org>2011-04-16 23:10:49 (GMT)
commitbfa882711578a1345e905961cffeb1e52cbe2e03 (patch)
tree6be9621fa5f4acbb839790cc4d46b238bee004e5
parentc339887d24a316365ddfc3f768d628202dd57fe8 (diff)
Don't use QDateTime::toString() for prepared queries.
When using bindValue() to specify datetime values, do not use toString(). Instead, pass the QDateTime to bindValue() so that it can pass the value using the MySQL-C-API MYSQL_TIME type--so that database datetime string literal format isn't an issue. Refs #8585. Thanks, again, to Rob Smith for finding another incorrect pattern to search for. (cherry picked from commit cd073b6e9b323958f785cab47884e605e4033885)
-rw-r--r--mythtv/libs/libmythtv/recordinginfo.cpp6
-rw-r--r--mythtv/programs/mythbackend/housekeeper.cpp2
-rw-r--r--mythtv/programs/mythfilldatabase/filldata.cpp4
3 files changed, 6 insertions, 6 deletions
diff --git a/mythtv/libs/libmythtv/recordinginfo.cpp b/mythtv/libs/libmythtv/recordinginfo.cpp
index aae62e4..4abab35 100644
--- a/mythtv/libs/libmythtv/recordinginfo.cpp
+++ b/mythtv/libs/libmythtv/recordinginfo.cpp
@@ -625,7 +625,7 @@ void RecordingInfo::ApplyRecordRecTitleChange(const QString &newTitle, const QSt
query.bindValue(":TITLE", newTitle);
query.bindValue(":SUBTITLE", newSubtitle);
query.bindValue(":CHANID", chanid);
- query.bindValue(":START", recstartts.toString("yyyyMMddhhmmss"));
+ query.bindValue(":START", recstartts);
if (!query.exec())
MythDB::DBError("RecTitle update", query);
@@ -1137,8 +1137,8 @@ void RecordingInfo::AddHistory(bool resched, bool forcedup)
":CATEGORY,:SERIESID,:PROGRAMID,:FINDID,:RECORDID,"
":STATION,:RECTYPE,:RECSTATUS,:DUPLICATE,:REACTIVATE);");
result.bindValue(":CHANID", chanid);
- result.bindValue(":START", startts.toString(Qt::ISODate));
- result.bindValue(":END", endts.toString(Qt::ISODate));
+ result.bindValue(":START", startts);
+ result.bindValue(":END", endts);
result.bindValue(":TITLE", title);
result.bindValue(":SUBTITLE", subtitle);
result.bindValue(":DESC", description);
diff --git a/mythtv/programs/mythbackend/housekeeper.cpp b/mythtv/programs/mythbackend/housekeeper.cpp
index 46e7591..f202e27 100644
--- a/mythtv/programs/mythbackend/housekeeper.cpp
+++ b/mythtv/programs/mythbackend/housekeeper.cpp
@@ -518,7 +518,7 @@ void HouseKeeper::CleanupRecordedTables(void)
while (query.next())
{
deleteQuery.bindValue(":CHANID", query.value(0).toString());
- deleteQuery.bindValue(":STARTTIME", query.value(1).toString());
+ deleteQuery.bindValue(":STARTTIME", query.value(1).toDateTime());
if (!deleteQuery.exec())
MythDB::DBError("HouseKeeper Cleaning Recorded Tables",
deleteQuery);
diff --git a/mythtv/programs/mythfilldatabase/filldata.cpp b/mythtv/programs/mythfilldatabase/filldata.cpp
index 39ed4c2..788219f 100644
--- a/mythtv/programs/mythfilldatabase/filldata.cpp
+++ b/mythtv/programs/mythfilldatabase/filldata.cpp
@@ -43,7 +43,7 @@ bool updateLastRunEnd(MSqlQuery &query)
query.prepare("UPDATE settings SET data = :ENDTIME "
"WHERE value='mythfilldatabaseLastRunEnd'");
- query.bindValue(":ENDTIME", qdtNow.toString("yyyy-MM-dd hh:mm"));
+ query.bindValue(":ENDTIME", qdtNow);
if (!query.exec())
{
@@ -59,7 +59,7 @@ bool updateLastRunStart(MSqlQuery &query)
query.prepare("UPDATE settings SET data = :STARTTIME "
"WHERE value='mythfilldatabaseLastRunStart'");
- query.bindValue(":STARTTIME", qdtNow.toString("yyyy-MM-dd hh:mm"));
+ query.bindValue(":STARTTIME", qdtNow);
if (!query.exec())
{