mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-08-04 22:29:29 +02:00
2022-02-21 Fred Gleason <fredg@paravelsystems.com>
* Added a '--print-progress' switch to rddbmgr(8). Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
a59712a5bf
commit
bc5c4de9db
@ -20836,3 +20836,5 @@
|
|||||||
2022-02-12 Fred Gleason <fredg@paravelsystems.com>
|
2022-02-12 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Rewrote the 'Cart Data Dump (CSV)' report in rdlibrary(1) to
|
* Rewrote the 'Cart Data Dump (CSV)' report in rdlibrary(1) to
|
||||||
use the CSV generation routines in 'lib/rdcsv.[cpp|h]'.
|
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).
|
||||||
|
@ -151,6 +151,18 @@
|
|||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<option>--print-progress</option>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Print a message to standard error giving current and elapsed
|
||||||
|
time whenever the database schema version is altered. Useful only
|
||||||
|
for debugging.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
|
@ -146,6 +146,10 @@ MainObject::MainObject(QObject *parent)
|
|||||||
db_mysql_engine=cmd->value(i);
|
db_mysql_engine=cmd->value(i);
|
||||||
cmd->setProcessed(i,true);
|
cmd->setProcessed(i,true);
|
||||||
}
|
}
|
||||||
|
if(cmd->key(i)=="--print-progress") {
|
||||||
|
db_start_datetime=QDateTime::currentDateTime();
|
||||||
|
cmd->setProcessed(i,true);
|
||||||
|
}
|
||||||
if(cmd->key(i)=="--set-schema") {
|
if(cmd->key(i)=="--set-schema") {
|
||||||
set_schema=cmd->value(i).toInt(&ok);
|
set_schema=cmd->value(i).toInt(&ok);
|
||||||
if((!ok)||(set_schema<=0)) {
|
if((!ok)||(set_schema<=0)) {
|
||||||
@ -379,8 +383,16 @@ MainObject::MainObject(QObject *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainObject::WriteSchemaVersion(int ver) const
|
void MainObject::WriteSchemaVersion(int ver)
|
||||||
{
|
{
|
||||||
|
if(!db_start_datetime.isNull()) {
|
||||||
|
QDateTime now=QDateTime::currentDateTime();
|
||||||
|
fprintf(stderr,"%s : setting schema version %d [%d secs]\n",
|
||||||
|
now.toString("yyyy-MM-dd hh:mm:ss").toUtf8().constData(),
|
||||||
|
ver,
|
||||||
|
db_start_datetime.secsTo(now));
|
||||||
|
db_start_datetime=now;
|
||||||
|
}
|
||||||
QString sql=QString("update VERSION set ")+
|
QString sql=QString("update VERSION set ")+
|
||||||
QString().sprintf("DB=%d",ver);
|
QString().sprintf("DB=%d",ver);
|
||||||
RDSqlQuery::apply(sql);
|
RDSqlQuery::apply(sql);
|
||||||
|
@ -124,7 +124,7 @@ class MainObject : public QObject
|
|||||||
//
|
//
|
||||||
bool PrintStatus(QString *err_msg) const;
|
bool PrintStatus(QString *err_msg) const;
|
||||||
|
|
||||||
void WriteSchemaVersion(int ver) const;
|
void WriteSchemaVersion(int ver);
|
||||||
bool TableExists(const QString &tbl_name) const;
|
bool TableExists(const QString &tbl_name) const;
|
||||||
bool DropTable(const QString &tbl_name,QString *err_msg=NULL) const;
|
bool DropTable(const QString &tbl_name,QString *err_msg=NULL) const;
|
||||||
bool ColumnExists(const QString &tbl_name,const QString &col_name) const;
|
bool ColumnExists(const QString &tbl_name,const QString &col_name) const;
|
||||||
@ -152,6 +152,7 @@ class MainObject : public QObject
|
|||||||
QString db_rehash;
|
QString db_rehash;
|
||||||
QString db_relink_audio;
|
QString db_relink_audio;
|
||||||
bool db_relink_audio_move;
|
bool db_relink_audio_move;
|
||||||
|
QDateTime db_start_datetime;
|
||||||
QString db_table_create_postfix;
|
QString db_table_create_postfix;
|
||||||
RDConfig *db_config;
|
RDConfig *db_config;
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// Update Rivendell DB schema.
|
// Update Rivendell DB schema.
|
||||||
//
|
//
|
||||||
// (C) Copyright 2018-2020 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
|
||||||
@ -38,6 +38,14 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg)
|
|||||||
RDCart *cart;
|
RDCart *cart;
|
||||||
bool length_update_required=false;
|
bool length_update_required=false;
|
||||||
|
|
||||||
|
if(!db_start_datetime.isNull()) {
|
||||||
|
QDateTime now=QDateTime::currentDateTime();
|
||||||
|
fprintf(stderr,
|
||||||
|
"%s : starting\n",
|
||||||
|
now.toString("yyyy-MM-dd hh:mm:ss").toUtf8().constData());
|
||||||
|
db_start_datetime=now;
|
||||||
|
}
|
||||||
|
|
||||||
if((cur_schema<3)&&(set_schema>=3)) {
|
if((cur_schema<3)&&(set_schema>=3)) {
|
||||||
//
|
//
|
||||||
// Create RDAIRPLAY Table
|
// Create RDAIRPLAY Table
|
||||||
@ -10443,8 +10451,9 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if((cur_schema<347)&&(set_schema>cur_schema)) {
|
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 ")+
|
sql=QString("alter table STACK_LINES add column ")+
|
||||||
"TITLE varchar(191) not null after ARTIST";
|
"TITLE varchar(191) not null default '' after ARTIST";
|
||||||
if(!RDSqlQuery::apply(sql,err_msg)) {
|
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -10453,6 +10462,13 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove the default attribute
|
||||||
|
sql=QString("alter table STACK_LINES alter column ")+
|
||||||
|
"TITLE varchar(191) not null";
|
||||||
|
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
WriteSchemaVersion(++cur_schema);
|
WriteSchemaVersion(++cur_schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10475,6 +10491,15 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg)
|
|||||||
sql=QString().sprintf("select NUMBER from CART where TYPE=%u",
|
sql=QString().sprintf("select NUMBER from CART where TYPE=%u",
|
||||||
RDCart::Audio);
|
RDCart::Audio);
|
||||||
q=new RDSqlQuery(sql,false);
|
q=new RDSqlQuery(sql,false);
|
||||||
|
if(!db_start_datetime.isNull()) {
|
||||||
|
QDateTime now=QDateTime::currentDateTime();
|
||||||
|
fprintf(stderr,
|
||||||
|
"%s : beginning cart length updates, %d carts to process [%d secs]\n",
|
||||||
|
now.toString("yyyy-MM-dd hh:mm:ss").toUtf8().constData(),
|
||||||
|
q->size(),
|
||||||
|
db_start_datetime.secsTo(now));
|
||||||
|
db_start_datetime=now;
|
||||||
|
}
|
||||||
while(q->next()) {
|
while(q->next()) {
|
||||||
cart=new RDCart(q->value(0).toUInt());
|
cart=new RDCart(q->value(0).toUInt());
|
||||||
cart->updateLength();
|
cart->updateLength();
|
||||||
@ -10484,6 +10509,16 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
*err_msg="ok";
|
*err_msg="ok";
|
||||||
|
|
||||||
|
if(!db_start_datetime.isNull()) {
|
||||||
|
QDateTime now=QDateTime::currentDateTime();
|
||||||
|
fprintf(stderr,
|
||||||
|
"%s : finished [%d secs]\n",
|
||||||
|
now.toString("yyyy-MM-dd hh:mm:ss").toUtf8().constData(),
|
||||||
|
db_start_datetime.secsTo(now));
|
||||||
|
db_start_datetime=now;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user