mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-09-10 01:13:20 +02:00
2018-10-29 Fred Gleason <fredg@paravelsystems.com>
* Backported a consistency check into schema update 291 in rddbmgr(8) to remove rdlogmanager(1) events with duplicate start times.
This commit is contained in:
parent
9338a14042
commit
ebe2869069
@ -17950,3 +17950,7 @@
|
|||||||
2018-10-29 Fred Gleason <fredg@paravelsystems.com>
|
2018-10-29 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Fixed a bug in the code to implement schema update/reversion 284
|
* Fixed a bug in the code to implement schema update/reversion 284
|
||||||
that did not properly add/drop the 'RDAIRPLAY.INSTANCE' field.
|
that did not properly add/drop the 'RDAIRPLAY.INSTANCE' field.
|
||||||
|
2018-10-29 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Backported a consistency check into schema update 291 in
|
||||||
|
rddbmgr(8) to remove rdlogmanager(1) events with duplicate start
|
||||||
|
times.
|
||||||
|
@ -7690,6 +7690,49 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg)
|
|||||||
while(q->next()) {
|
while(q->next()) {
|
||||||
QString tablename=q->value(0).toString()+"_CLK";
|
QString tablename=q->value(0).toString()+"_CLK";
|
||||||
tablename.replace(" ","_");
|
tablename.replace(" ","_");
|
||||||
|
|
||||||
|
/* *** HACK WARNING *** HACK WARNING ***
|
||||||
|
*
|
||||||
|
* This check works around a bug in Rivendell v2.x that permitted
|
||||||
|
* clocks to have events with the same start time. It deletes all
|
||||||
|
* such 'conflicting' events except the one with the lowest ID number.
|
||||||
|
*/
|
||||||
|
QList<unsigned> deleted_ids;
|
||||||
|
sql=QString("select ")+
|
||||||
|
"ID,"+ // 00
|
||||||
|
"EVENT_NAME,"+ // 01
|
||||||
|
"START_TIME,"+ // 02
|
||||||
|
"LENGTH "+ // 03
|
||||||
|
"from `"+tablename+"` "+
|
||||||
|
"order by ID";
|
||||||
|
q1=new RDSqlQuery(sql);
|
||||||
|
while(q1->next()) {
|
||||||
|
sql=QString("select ")+
|
||||||
|
"ID,"+ // 00
|
||||||
|
"EVENT_NAME "+ // 01
|
||||||
|
"from `"+tablename+"` where "+
|
||||||
|
QString().sprintf("START_TIME=%d && ",q1->value(2).toInt())+
|
||||||
|
QString().sprintf("ID!=%u ",q1->value(0).toUInt())+
|
||||||
|
"order by ID";
|
||||||
|
q2=new RDSqlQuery(sql);
|
||||||
|
while(q2->next()) {
|
||||||
|
if(!deleted_ids.contains(q1->value(0).toUInt())) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"WARNING: deleted conflicting event \"%s\" from clock \"%s\"\n",
|
||||||
|
(const char *)q2->value(1).toString().toUtf8(),
|
||||||
|
(const char *)q->value(0).toString().toUtf8());
|
||||||
|
sql=QString("delete ")+
|
||||||
|
"from `"+tablename+"` where "+
|
||||||
|
QString().sprintf("ID=%u",q2->value(0).toUInt());
|
||||||
|
RDSqlQuery::apply(sql);
|
||||||
|
deleted_ids.push_back(q2->value(0).toUInt());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete q2;
|
||||||
|
}
|
||||||
|
delete q1;
|
||||||
|
/* *** END OF HACK WARNING *** END OF HACK WARNING ***/
|
||||||
|
|
||||||
sql=QString("select ")+
|
sql=QString("select ")+
|
||||||
"EVENT_NAME,"+ // 00
|
"EVENT_NAME,"+ // 00
|
||||||
"START_TIME,"+ // 01
|
"START_TIME,"+ // 01
|
||||||
|
Loading…
x
Reference in New Issue
Block a user