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-03-02 19:59:51 (GMT)
commitcd073b6e9b323958f785cab47884e605e4033885 (patch)
treea329b20fbb514b8e23c3f08468a0458ea834efb8
parenta50a337eb7e5eef01032eb00732c86bd0d8e9da1 (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.
-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 da235dd..41a25b1 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);
@@ -1141,8 +1141,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 c127ab8..9729170 100644
--- a/mythtv/programs/mythbackend/housekeeper.cpp
+++ b/mythtv/programs/mythbackend/housekeeper.cpp
@@ -543,7 +543,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 2010796..49d88e1 100644
--- a/mythtv/programs/mythfilldatabase/filldata.cpp
+++ b/mythtv/programs/mythfilldatabase/filldata.cpp
@@ -44,7 +44,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())
{
@@ -60,7 +60,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())
{