2022-05-23 Fred Gleason <fredg@paravelsystems.com>

* Fixed a regression in rdcartslots(1) that caused default settings
	to fail to be loaded correctly at startup.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2022-05-23 12:28:44 -04:00
parent 05634ae562
commit 42a2b1a0dd
6 changed files with 68 additions and 9 deletions

View File

@ -23138,3 +23138,10 @@
* Fixed a regression in the 'Configure RDCatch' dialog in rdcatch(1) * Fixed a regression in the 'Configure RDCatch' dialog in rdcatch(1)
that caused the 'Select' buttons in the 'Events Carts' section to that caused the 'Select' buttons in the 'Events Carts' section to
fail to save the selected macro cart number. fail to save the selected macro cart number.
2022-05-20 Fred Gleason <fredg@paravelsystems.com>
* Added a schema pseudo-update to rewrite the audio input and output
names to correctly unique default values.
* Incremented the database version to 356.
2022-05-23 Fred Gleason <fredg@paravelsystems.com>
* Fixed a regression in rdcartslots(1) that caused default settings
to fail to be loaded correctly at startup.

View File

@ -2,7 +2,7 @@
// //
// The Current Database Schema Version for Rivendell // The Current Database Schema Version for Rivendell
// //
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2022 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as // it under the terms of the GNU General Public License version 2 as
@ -24,7 +24,7 @@
/* /*
* Current Database Version * Current Database Version
*/ */
#define RD_VERSION_DATABASE 355 #define RD_VERSION_DATABASE 356
#endif // DBVERSION_H #endif // DBVERSION_H

View File

@ -2,7 +2,7 @@
// //
// Container class for RDCartSlot options // Container class for RDCartSlot options
// //
// (C) Copyright 2012-2021 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2012-2022 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as // it under the terms of the GNU General Public License version 2 as
@ -141,7 +141,6 @@ bool RDSlotOptions::load()
bool ret=false; bool ret=false;
QString sql; QString sql;
RDSqlQuery *q; RDSqlQuery *q;
sql=QString("select ")+ sql=QString("select ")+
"`CARTSLOTS`.`CARD`,"+ // 00 "`CARTSLOTS`.`CARD`,"+ // 00
"`CARTSLOTS`.`INPUT_PORT`,"+ // 01 "`CARTSLOTS`.`INPUT_PORT`,"+ // 01
@ -157,10 +156,12 @@ bool RDSlotOptions::load()
"`CARTSLOTS`.`SERVICE_NAME`,"+ // 11 "`CARTSLOTS`.`SERVICE_NAME`,"+ // 11
"`AUDIO_OUTPUTS`.`LABEL` "+ // 12 "`AUDIO_OUTPUTS`.`LABEL` "+ // 12
"from `CARTSLOTS` left join `AUDIO_OUTPUTS` "+ "from `CARTSLOTS` left join `AUDIO_OUTPUTS` "+
"on `CARTSLOTS`.`OUTPUT_PORT`=`AUDIO_OUTPUTS`.`PORT_NUMBER` where "+ "on `CARTSLOTS`.`OUTPUT_PORT`=`AUDIO_OUTPUTS`.`PORT_NUMBER` && "+
"`AUDIO_OUTPUTS`.`STATION_NAME`='"+RDEscapeString(set_stationname)+"' && "+
"`AUDIO_OUTPUTS`.`CARD_NUMBER`=`CARTSLOTS`.`CARD` && "+ "`AUDIO_OUTPUTS`.`CARD_NUMBER`=`CARTSLOTS`.`CARD` && "+
"`AUDIO_OUTPUTS`.`PORT_NUMBER`=`CARTSLOTS`.`OUTPUT_PORT` && "+ "`AUDIO_OUTPUTS`.`PORT_NUMBER`=`CARTSLOTS`.`OUTPUT_PORT` && "+
"`CARTSLOTS`.`STATION_NAME`=`AUDIO_OUTPUTS`.`STATION_NAME` where "+
"`AUDIO_OUTPUTS`.`STATION_NAME`='"+RDEscapeString(set_stationname)+"' && "+
"`CARTSLOTS`.`OUTPUT_PORT`=`AUDIO_OUTPUTS`.`PORT_NUMBER` && "+
QString::asprintf("`CARTSLOTS`.`SLOT_NUMBER`=%u",set_slotno); QString::asprintf("`CARTSLOTS`.`SLOT_NUMBER`=%u",set_slotno);
q=new RDSqlQuery(sql); q=new RDSqlQuery(sql);
if(q->first()) { if(q->first()) {

View File

@ -2,7 +2,7 @@
// //
// Revert Rivendell DB schema // Revert Rivendell DB schema
// //
// (C) Copyright 2018-2021 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2018-2022 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as // it under the terms of the GNU General Public License version 2 as
@ -41,6 +41,15 @@ bool MainObject::RevertSchema(int cur_schema,int set_schema,QString *err_msg)
// NEW SCHEMA REVERSIONS GO HERE... // NEW SCHEMA REVERSIONS GO HERE...
//
// Revert 356
//
if((cur_schema==356)&&(set_schema<cur_schema)) {
// Nothing to do here!
WriteSchemaVersion(--cur_schema);
}
// //
// Revert 355 // Revert 355
// //

View File

@ -2,7 +2,7 @@
// //
// DB schema version <==> Rivendell version map // DB schema version <==> Rivendell version map
// //
// (C) Copyright 2018-2021 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2018-2022 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as // it under the terms of the GNU General Public License version 2 as
@ -160,7 +160,7 @@ void MainObject::InitializeSchemaMap() {
global_version_map["3.4"]=317; global_version_map["3.4"]=317;
global_version_map["3.5"]=346; global_version_map["3.5"]=346;
global_version_map["3.6"]=347; global_version_map["3.6"]=347;
global_version_map["4.0"]=355; global_version_map["4.0"]=356;
} }

View File

@ -10974,6 +10974,48 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg)
WriteSchemaVersion(++cur_schema); WriteSchemaVersion(++cur_schema);
} }
if((cur_schema<356)&&(set_schema>cur_schema)) {
//
// Maintainer's Note:
//
// A 'pseudo-schema' change. No actual schema changes, just rewrite
// the default audio port names so each port gets a properly unique
// name.
//
// Use hard-coded maximum card/port quantities (24 for each) here,
// in case the #define'd values change in future!
//
sql=QString("select `NAME` from `STATIONS`");
q=new RDSqlQuery(sql);
while(q->next()) {
for(int i=0;i<24;i++) {
for(int j=0;j<24;j++) {
sql=QString("update `AUDIO_INPUTS` set ")+
"`LABEL`='"+RDEscapeString(QString::asprintf("M%d",24*i+j+1))+
"' where "+
"`STATION_NAME`='"+RDEscapeString(q->value(0).toString())+"' && "+
QString::asprintf("`CARD_NUMBER`=%d && ",i)+
QString::asprintf("`PORT_NUMBER`=%d",j);
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
sql=QString("update `AUDIO_OUTPUTS` set ")+
"`LABEL`='"+RDEscapeString(QString::asprintf("M%d",24*i+j+1))+
"' where "+
"`STATION_NAME`='"+RDEscapeString(q->value(0).toString())+"' && "+
QString::asprintf("`CARD_NUMBER`=%d && ",i)+
QString::asprintf("`PORT_NUMBER`=%d",j);
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
}
}
}
WriteSchemaVersion(++cur_schema);
}
// NEW SCHEMA UPDATES GO HERE... // NEW SCHEMA UPDATES GO HERE...