mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-12 07:01:10 +02:00
Merge branch 'deltecent-issue157-stack' into stable
This commit is contained in:
commit
b64c6c377d
@ -16992,3 +16992,6 @@
|
|||||||
* Dropped the 'SERVICES.MUS_LENGTH_OFFSET' field from the database.
|
* Dropped the 'SERVICES.MUS_LENGTH_OFFSET' field from the database.
|
||||||
* Dropped the 'SERVICES.MUS_LENGTH_LENGTH' field from the database.
|
* Dropped the 'SERVICES.MUS_LENGTH_LENGTH' field from the database.
|
||||||
* Incremented the database version to 286.
|
* Incremented the database version to 286.
|
||||||
|
2018-05-31 Patrick Linstruth <patrick@deltecent.com>
|
||||||
|
* Implemented purging of STACK_* tables for RDMaint(1) in
|
||||||
|
'utils/rdmaint/rdmaint.cpp' and 'utils/rdmaint/rdmaint.h'.
|
||||||
|
@ -127,6 +127,7 @@ void MainObject::RunSystemMaintenance()
|
|||||||
PurgeElr();
|
PurgeElr();
|
||||||
PurgeGpioEvents();
|
PurgeGpioEvents();
|
||||||
PurgeWebapiAuths();
|
PurgeWebapiAuths();
|
||||||
|
PurgeStacks();
|
||||||
RehashCuts();
|
RehashCuts();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,6 +287,59 @@ void MainObject::PurgeWebapiAuths()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainObject::PurgeStacks()
|
||||||
|
{
|
||||||
|
QString sql;
|
||||||
|
RDSqlQuery *q;
|
||||||
|
RDSqlQuery *q1;
|
||||||
|
RDSqlQuery *q2;
|
||||||
|
int stackid;
|
||||||
|
int stacksize;
|
||||||
|
int artistsep=50000;
|
||||||
|
int titlesep=50000;
|
||||||
|
|
||||||
|
sql="select MAX(ARTISTSEP) from CLOCKS";
|
||||||
|
q=new RDSqlQuery(sql);
|
||||||
|
if(q->next()) {
|
||||||
|
artistsep=q->value(0).toInt();
|
||||||
|
}
|
||||||
|
delete q;
|
||||||
|
|
||||||
|
sql="select MAX(TITLE_SEP) from EVENTS";
|
||||||
|
q=new RDSqlQuery(sql);
|
||||||
|
if(q->next()) {
|
||||||
|
titlesep=q->value(0).toInt();
|
||||||
|
}
|
||||||
|
delete q;
|
||||||
|
|
||||||
|
stacksize=(artistsep<titlesep)?titlesep:artistsep;
|
||||||
|
|
||||||
|
sql="select NAME from SERVICES";
|
||||||
|
q=new RDSqlQuery(sql);
|
||||||
|
while(q->next()) {
|
||||||
|
QString tablename=q->value(0).toString()+"_STACK";
|
||||||
|
tablename.replace(" ","_");
|
||||||
|
sql=QString().sprintf("SELECT MAX(SCHED_STACK_ID) from %s",(const char*)tablename);
|
||||||
|
q1=new RDSqlQuery(sql);
|
||||||
|
if (q1->next())
|
||||||
|
{
|
||||||
|
stackid=q1->value(0).toUInt();
|
||||||
|
if (stackid-stacksize > 0) {
|
||||||
|
sql=QString().sprintf("DELETE from `%s` where SCHED_STACK_ID <= %d", (const char*)tablename, stackid-stacksize);
|
||||||
|
q2=new RDSqlQuery(sql);
|
||||||
|
delete q2;
|
||||||
|
|
||||||
|
sql=QString().sprintf("UPDATE `%s` SET SCHED_STACK_ID=SCHED_STACK_ID-%d", (const char*)tablename, stackid-stacksize);
|
||||||
|
q2=new RDSqlQuery(sql);
|
||||||
|
delete q2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete q1;
|
||||||
|
}
|
||||||
|
delete q;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainObject::RehashCuts()
|
void MainObject::RehashCuts()
|
||||||
{
|
{
|
||||||
QString sql;
|
QString sql;
|
||||||
|
@ -39,6 +39,7 @@ class MainObject : public QObject
|
|||||||
void PurgeDropboxes();
|
void PurgeDropboxes();
|
||||||
void PurgeGpioEvents();
|
void PurgeGpioEvents();
|
||||||
void PurgeWebapiAuths();
|
void PurgeWebapiAuths();
|
||||||
|
void PurgeStacks();
|
||||||
void RehashCuts();
|
void RehashCuts();
|
||||||
bool maint_verbose;
|
bool maint_verbose;
|
||||||
bool maint_system;
|
bool maint_system;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user