mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2026-01-11 15:16:07 +01:00
2018-07-05 Fred Gleason <fredg@paravelsystems.com>
* Added an 'ELR_LINES' table to the database. * Incremented the database version to 289. * Removed the 'RDSvc::serviceTableName()' method.
This commit is contained in:
@@ -22,8 +22,11 @@
|
||||
#include <qstring.h>
|
||||
#include <qlabel.h>
|
||||
#include <qpalette.h>
|
||||
|
||||
#include <rddb.h>
|
||||
#include <svc_rec.h>
|
||||
#include <rdescape_string.h>
|
||||
|
||||
#include "svc_rec.h"
|
||||
|
||||
//
|
||||
// Global Classes
|
||||
@@ -46,14 +49,12 @@ SvcRec::SvcRec(const QString &svcname,QWidget *parent)
|
||||
//
|
||||
// Generate Date Boundaries
|
||||
//
|
||||
pick_tablename=svcname;
|
||||
pick_tablename.replace(" ","_");
|
||||
QDate current_date=QDate::currentDate();
|
||||
pick_high_year=current_date.year();
|
||||
pick_low_year=pick_high_year;
|
||||
sql=QString().sprintf("select EVENT_DATETIME from `%s_SRT`\
|
||||
order by EVENT_DATETIME",
|
||||
(const char *)pick_tablename);
|
||||
sql=QString("select EVENT_DATETIME from ELR_LINES where ")+
|
||||
"SERVICE_NAME=\""+RDEscapeString(svcname)+"\" "+
|
||||
"order by EVENT_DATETIME";
|
||||
q=new RDSqlQuery(sql);
|
||||
if(q->first()) {
|
||||
pick_low_year=q->value(0).toDate().year();
|
||||
@@ -214,14 +215,10 @@ void SvcRec::deleteDay()
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
|
||||
QString tablename=pick_service_name;
|
||||
tablename.replace(" ","_");
|
||||
sql=QString().sprintf("delete from `%s_SRT` where \
|
||||
(EVENT_DATETIME>=\"%s\")&&\
|
||||
(EVENT_DATETIME<=\"%s\")",
|
||||
(const char *)tablename,
|
||||
(const char *)date().toString("yyyy-MM-dd 00:00:00"),
|
||||
(const char *)date().toString("yyyy-MM-dd 23:59:59"));
|
||||
sql=QString("delete from ELR_LINES where ")+
|
||||
"SERVICE_NAME=\""+RDEscapeString(pick_service_name)+"\" && "+
|
||||
"EVENT_DATETIME>=\""+date().toString("yyyy-MM-dd 00:00:00")+"\" && "+
|
||||
"EVENT_DATETIME<\""+date().addDays(1).toString("yyyy-MM-dd 00:00:00")+"\"";
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
GetActiveDays(pick_date);
|
||||
@@ -403,13 +400,11 @@ void SvcRec::GetActiveDays(const QDate &date)
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
|
||||
for(int i=0;i<=31;i++) {
|
||||
sql=QString().sprintf("select ID from `%s_SRT` where \
|
||||
(EVENT_DATETIME>=\"%s-%02d 00:00:00\")&&\
|
||||
(EVENT_DATETIME<=\"%s-%02d 23:59:59\")",
|
||||
(const char *)pick_tablename,
|
||||
(const char *)date.toString("yyyy-MM"),i+1,
|
||||
(const char *)date.toString("yyyy-MM"),i+1);
|
||||
for(int i=0;i<=date.daysInMonth();i++) {
|
||||
sql=QString("select ID from ELR_LINES where ")+
|
||||
"SERVICE_NAME=\""+RDEscapeString(pick_service_name)+"\" && "+
|
||||
"(EVENT_DATETIME>=\""+date.toString("yyyy-MM")+QString().sprintf("-%02d 00:00:00\")&&",i+1)+
|
||||
"(EVENT_DATETIME<=\""+date.toString("yyyy-MM")+QString().sprintf("-%02d 23:59:59\")",i+1);
|
||||
q=new RDSqlQuery(sql);
|
||||
pick_active_days[i]=q->first();
|
||||
delete q;
|
||||
|
||||
Reference in New Issue
Block a user