2022-02-22 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:
Fred Gleason
2022-02-22 08:44:22 -05:00
parent 6dd815a570
commit a2f8ddd9bc
5 changed files with 60 additions and 6 deletions

View File

@@ -2,7 +2,7 @@
//
// Rivendell database management utility
//
// (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
// it under the terms of the GNU General Public License version 2 as
@@ -146,6 +146,10 @@ MainObject::MainObject(QObject *parent)
db_mysql_engine=cmd->value(i);
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") {
set_schema=cmd->value(i).toInt(&ok);
if((!ok)||(set_schema<=0)) {
@@ -384,8 +388,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 [%lld 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::asprintf("`DB`=%d",ver);
RDSqlQuery::apply(sql);