2016-07-26 Fred Gleason <fredg@paravelsystems.com>

* Added a sanity check in the 'RDCut::setMetadata()' method in
	'lib/rdcut.cpp' to ensure that the cut 'Description' field is always
	populated.
This commit is contained in:
Fred Gleason 2016-07-26 11:55:43 -04:00
parent 9550815023
commit a20b7f2437
2 changed files with 22 additions and 0 deletions

View File

@ -15416,3 +15416,7 @@
'SERVICE_CLOCKS' table.
* Modified 'rdlogmanager/list_clocks.cpp' to use the new
'SERVICE_CLOCKS' table.
2016-07-26 Fred Gleason <fredg@paravelsystems.com>
* Added a sanity check in the 'RDCut::setMetadata()' method in
'lib/rdcut.cpp' to ensure that the cut 'Description' field is always
populated.

View File

@ -1135,6 +1135,24 @@ void RDCut::setMetadata(RDWaveData *data) const
sprintf(" where CUT_NAME=\"%s\"",(const char *)cut_name.utf8());
RDSqlQuery *q=new RDSqlQuery(sql);
delete q;
//
// Sanity Check: NEVER permit the 'description' field to be empty.
//
sql=QString("select DESCRIPTION from CUTS where ")+
"CUT_NAME=\""+RDEscapeString(cut_name)+"\"";
q=new RDSqlQuery(sql);
if(q->first()) {
if(q->value(0).toString().isEmpty()) {
sql=QString("update CUTS set ")+
QString().sprintf("DESCRIPTION=\"Cut %03d\"",
RDCut::cutNumber(cut_name))+
" where CUT_NAME=\""+RDEscapeString(cut_name)+"\"";
delete q;
q=new RDSqlQuery(sql);
}
}
delete q;
}