2022-02-22 Fred Gleason <fredg@paravelsystems.com>

* Fixed a bug in rddbmgr(8) that could cause the 346=>347 schema
	conversion to hang indefinitely with databases containing large
	cart libraries.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2022-02-22 08:15:18 -05:00
parent bc5c4de9db
commit f139696aec
2 changed files with 17 additions and 12 deletions

View File

@ -20838,3 +20838,7 @@
use the CSV generation routines in 'lib/rdcsv.[cpp|h]'.
2022-02-21 Fred Gleason <fredg@paravelsystems.com>
* Added a '--print-progress' switch to rddbmgr(8).
2022-02-22 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in rddbmgr(8) that could cause the 346=>347 schema
conversion to hang indefinitely with databases containing large
cart libraries.

View File

@ -10451,24 +10451,23 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg)
}
if((cur_schema<347)&&(set_schema>cur_schema)) {
// Set a default value so the "alter" operation succeeds
sql=QString("alter table STACK_LINES add column ")+
"TITLE varchar(191) not null default '' after ARTIST";
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
if (!StackLineTitles347(err_msg)) {
return false;
}
// Remove the default attribute
sql=QString("alter table STACK_LINES alter column ")+
"TITLE varchar(191) not null";
sql=QString("create index CART_IDX on STACK_LINES(CART)");
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
if (!StackLineTitles347(err_msg)) {
return false;
}
sql=QString("drop index CART_IDX on STACK_LINES");
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
WriteSchemaVersion(++cur_schema);
}
@ -10771,12 +10770,14 @@ bool MainObject::StackLineTitles347(QString *err_msg) const
//
// Add titles to STACK_LINES
//
q=new RDSqlQuery("select NUMBER,TITLE from CART",false);
q=new RDSqlQuery("select NUMBER,TITLE from CART order by NUMBER",false);
while(q->next()) {
if(!q->value(1).isNull()) {
sql=QString("update STACK_LINES set ")+
"TITLE=\""+RDEscapeString(q->value(1).toString().lower().replace(" ",""))+"\" "+
"where CART=\""+RDEscapeString(q->value(0).toString())+"\"";
"TITLE=\""+
RDEscapeString(q->value(1).toString().lower().replace(" ",""))+"\" "+
"where "+
QString().sprintf("CART=%u",q->value(0).toUInt());
if(!RDSqlQuery::apply(sql,err_msg)) {
delete q;
return false;