mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-07-23 07:58:09 +02:00
lib/rdsvc.cpp Added null checks to purge_date as per MySQL v5.7+ changes
Changed purge_date to a QString so that it can be checked with the normal RDCheckDateTime function. Also means the QString.isEmpty check is a straight forward QDate.isValid and in that case we can use QDate.toString rather than formatting via RDCheckDateTime (and incurring another QDate.isValid check).
This commit is contained in:
parent
e1c9caa987
commit
4523e8e90f
@ -754,9 +754,9 @@ bool RDSvc::generateLog(const QDate &date,const QString &logname,
|
||||
//
|
||||
// Generate Log Structure
|
||||
//
|
||||
QString purge_date;
|
||||
QDate purge_date;
|
||||
if(defaultLogShelflife()>=0) {
|
||||
purge_date=date.addDays(defaultLogShelflife()).toString("yyyy-MM-dd");
|
||||
purge_date=date.addDays(defaultLogShelflife());
|
||||
}
|
||||
sql=QString().sprintf("select NAME from LOGS where NAME=\"%s\"",
|
||||
(const char *)RDEscapeString(logname));
|
||||
@ -771,8 +771,8 @@ bool RDSvc::generateLog(const QDate &date,const QString &logname,
|
||||
(const char *)RDEscapeString(svc_name),
|
||||
(const char *)RDEscapeString(RDDateDecode(descriptionTemplate(),date)),
|
||||
"RDLogManager");
|
||||
if(!purge_date.isEmpty()) {
|
||||
sql+=(",PURGE_DATE=\""+purge_date+"\"");
|
||||
if(!purge_date.isValid()) {
|
||||
sql+=(",PURGE_DATE=\""+purge_date.toString("yyyy-MM-dd")+"\"");
|
||||
}
|
||||
sql+=(" where NAME=\""+RDEscapeString(logname)+"\"");
|
||||
|
||||
@ -793,7 +793,7 @@ bool RDSvc::generateLog(const QDate &date,const QString &logname,
|
||||
(const char *)RDEscapeString(svc_name),
|
||||
(const char *)RDEscapeString(RDDateDecode(descriptionTemplate(),date)),
|
||||
"RDLogManager",
|
||||
(const char *)purge_date);
|
||||
(const char *)RDCheckDateTime(purge_date,"yyyy-MM-dd"));
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user