mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-08 15:53:03 +02:00
2018-08-16 Fred Gleason <fredg@paravelsystems.com>
* Removed obsolete DB checks from rddbmgr(8).
This commit is contained in:
parent
be35efdd86
commit
aeedeef9af
@ -17442,3 +17442,5 @@
|
|||||||
* Fixed style inconsistencies in dialogs within rdsoftkeys(1).
|
* Fixed style inconsistencies in dialogs within rdsoftkeys(1).
|
||||||
2018-08-16 Fred Gleason <fredg@paravelsystems.com>
|
2018-08-16 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Fixed style inconsistencies in dialogs within rmlsend(1).
|
* Fixed style inconsistencies in dialogs within rmlsend(1).
|
||||||
|
2018-08-16 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Removed obsolete DB checks from rddbmgr(8).
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <qdir.h>
|
#include <qdir.h>
|
||||||
//Added by qt3to4:
|
|
||||||
#include <QSqlQuery>
|
|
||||||
|
|
||||||
#include <dbversion.h>
|
#include <dbversion.h>
|
||||||
#include <rdcart.h>
|
#include <rdcart.h>
|
||||||
@ -63,23 +61,6 @@ bool MainObject::Check(QString *err_msg) const
|
|||||||
CheckOrphanedTracks();
|
CheckOrphanedTracks();
|
||||||
printf("done.\n\n");
|
printf("done.\n\n");
|
||||||
|
|
||||||
//
|
|
||||||
// Check RDLogManager Consistency
|
|
||||||
//
|
|
||||||
printf("Checking RDLogManager events...\n");
|
|
||||||
CheckEvents();
|
|
||||||
printf("done.\n\n");
|
|
||||||
printf("Checking RDLogManager clocks...\n");
|
|
||||||
CheckClocks();
|
|
||||||
printf("done.\n\n");
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check for orphaned tables
|
|
||||||
//
|
|
||||||
printf("Checking for orphaned tables...\n");
|
|
||||||
CheckOrphanedTables();
|
|
||||||
printf("done.\n\n");
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check for stale reservations
|
// Check for stale reservations
|
||||||
//
|
//
|
||||||
@ -241,197 +222,6 @@ void MainObject::CheckOrphanedTracks() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainObject::CheckClocks() const
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// FIXME: This entire check needs to be rewritten!
|
|
||||||
//
|
|
||||||
/*
|
|
||||||
QString sql;
|
|
||||||
QSqlQuery *q;
|
|
||||||
QSqlQuery *q1;
|
|
||||||
QSqlQuery *q2;
|
|
||||||
QSqlQuery *q3;
|
|
||||||
QString eventname;
|
|
||||||
|
|
||||||
sql="select NAME from CLOCKS";
|
|
||||||
q=new QSqlQuery(sql);
|
|
||||||
while(q->next()) {
|
|
||||||
//
|
|
||||||
// Check the CLK Table
|
|
||||||
//
|
|
||||||
sql=QString("select EVENT_NAME,ID from ")+
|
|
||||||
RDClock::tableName(q->value(0).toString());
|
|
||||||
q1=new QSqlQuery(sql);
|
|
||||||
if(q1->isActive()) {
|
|
||||||
//
|
|
||||||
// Check the clock -> event linkage
|
|
||||||
//
|
|
||||||
while(q1->next()) {
|
|
||||||
sql=QString().sprintf("select NAME from EVENTS where NAME=\"%s\"",
|
|
||||||
(const char *)q1->value(0).toString());
|
|
||||||
q2=new QSqlQuery(sql);
|
|
||||||
if(q2->first()) {
|
|
||||||
if(q1->value(0)!=q2->value(0)) { // Make sure the cases match!
|
|
||||||
printf(" Clock %s's linkage to event %s is broken -- fix (y/N)? ",
|
|
||||||
(const char *)q->value(0).toString(),
|
|
||||||
(const char *)q2->value(0).toString());
|
|
||||||
fflush(NULL);
|
|
||||||
if(UserResponse()) {
|
|
||||||
sql=QString("update ")+
|
|
||||||
RDClock::tableName(q->value(0).toString())+
|
|
||||||
" set EVENT_NAME=\""+RDEscapeString(q2->value(0).toString())+
|
|
||||||
"\""+QString().sprintf(" where ID=%d",q1->value(1).toInt());
|
|
||||||
q3=new QSqlQuery(sql);
|
|
||||||
delete q3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete q2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printf(" Clock %s is missing the CLK table -- fix (y/N)? ",
|
|
||||||
(const char *)q->value(0).toString());
|
|
||||||
fflush(NULL);
|
|
||||||
if(UserResponse()) {
|
|
||||||
sql=RDCreateClockTableSql(RDClock::tableName(q->value(0).toString()),
|
|
||||||
db_config);
|
|
||||||
q2=new QSqlQuery(sql);
|
|
||||||
delete q2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete q1;
|
|
||||||
}
|
|
||||||
delete q;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MainObject::CheckEvents() const
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// FIXME: This whole check needs to be rewritten!
|
|
||||||
//
|
|
||||||
/*
|
|
||||||
QString sql;
|
|
||||||
QSqlQuery *q;
|
|
||||||
QSqlQuery *q1;
|
|
||||||
QSqlQuery *q2;
|
|
||||||
QString eventname;
|
|
||||||
|
|
||||||
sql="select NAME from EVENTS";
|
|
||||||
q=new QSqlQuery(sql);
|
|
||||||
while(q->next()) {
|
|
||||||
eventname=q->value(0).toString();
|
|
||||||
eventname.replace(" ","_");
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check the PRE Table
|
|
||||||
//
|
|
||||||
sql=QString().sprintf ("select ID from %s_PRE",(const char *)eventname);
|
|
||||||
q1=new QSqlQuery(sql);
|
|
||||||
if(q1->size()<0) {
|
|
||||||
printf(" Event %s is missing the PRE table -- fix (y/N)? ",
|
|
||||||
(const char *)q->value(0).toString());
|
|
||||||
fflush(NULL);
|
|
||||||
if(UserResponse()) {
|
|
||||||
sql=RDCreateLogTableSql(eventname+"_PRE",db_config);
|
|
||||||
q2=new QSqlQuery(sql);
|
|
||||||
delete q2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete q1;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check the POST Table
|
|
||||||
//
|
|
||||||
sql=QString().sprintf ("select ID from %s_POST",(const char *)eventname);
|
|
||||||
q1=new QSqlQuery(sql);
|
|
||||||
if(!q1->isActive()) {
|
|
||||||
printf(" Event %s is missing the POST table -- fix (y/N)? ",
|
|
||||||
(const char *)q->value(0).toString());
|
|
||||||
fflush(NULL);
|
|
||||||
if(UserResponse()) {
|
|
||||||
sql=RDCreateLogTableSql(eventname+"_POST",db_config);
|
|
||||||
q2=new QSqlQuery(sql);
|
|
||||||
delete q2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete q1;
|
|
||||||
}
|
|
||||||
delete q;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MainObject::CheckOrphanedTables() const
|
|
||||||
{
|
|
||||||
QSqlQuery *table_q;
|
|
||||||
QSqlQuery *q;
|
|
||||||
QString sql;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Generate Table Query
|
|
||||||
//
|
|
||||||
sql="show tables";
|
|
||||||
table_q=new QSqlQuery(sql);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Look for orphaned clocks
|
|
||||||
//
|
|
||||||
sql="select NAME from CLOCKS";
|
|
||||||
q=new QSqlQuery(sql);
|
|
||||||
CleanTables("CLK",table_q,q);
|
|
||||||
CleanTables("RULES",table_q,q);
|
|
||||||
delete q;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Look for orphaned events
|
|
||||||
//
|
|
||||||
sql="select NAME from EVENTS";
|
|
||||||
q=new QSqlQuery(sql);
|
|
||||||
CleanTables("PRE",table_q,q);
|
|
||||||
CleanTables("POST",table_q,q);
|
|
||||||
delete q;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Look for orphaned logs
|
|
||||||
//
|
|
||||||
sql="select NAME from LOGS";
|
|
||||||
q=new QSqlQuery(sql);
|
|
||||||
CleanTables("LOG",table_q,q);
|
|
||||||
CleanTables("STACK",table_q,q);
|
|
||||||
delete q;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Look for orphaned services
|
|
||||||
//
|
|
||||||
sql="select NAME from SERVICES";
|
|
||||||
q=new QSqlQuery(sql);
|
|
||||||
CleanTables("SRT",table_q,q);
|
|
||||||
delete q;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Look for orphaned feeds
|
|
||||||
//
|
|
||||||
sql="select KEY_NAME from FEEDS";
|
|
||||||
q=new QSqlQuery(sql);
|
|
||||||
CleanTables("FIELDS",table_q,q);
|
|
||||||
CleanTables("FLG",table_q,q);
|
|
||||||
delete q;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Look for stale and obsolete tables
|
|
||||||
//
|
|
||||||
CleanTables("IMP",table_q);
|
|
||||||
CleanTables("REC",table_q);
|
|
||||||
|
|
||||||
|
|
||||||
delete table_q;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MainObject::CheckCutCounts() const
|
void MainObject::CheckCutCounts() const
|
||||||
{
|
{
|
||||||
QString sql;
|
QString sql;
|
||||||
@ -788,71 +578,6 @@ void MainObject::SetCutLength(const QString &cutname,int len) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainObject::CleanTables(const QString &ext,QSqlQuery *table_q,
|
|
||||||
QSqlQuery *name_q) const
|
|
||||||
{
|
|
||||||
QString sql;
|
|
||||||
QSqlQuery *q1;
|
|
||||||
|
|
||||||
table_q->seek(-1);
|
|
||||||
while(table_q->next()) {
|
|
||||||
if(!IsTableLinked(name_q,ext,table_q->value(0).toString())) {
|
|
||||||
printf(" Table %s is orphaned -- delete (y/N)? ",
|
|
||||||
(const char *)RDEscapeString(table_q->value(0).toString()));
|
|
||||||
fflush(NULL);
|
|
||||||
if(UserResponse()) {
|
|
||||||
sql=QString().sprintf("drop table %s",
|
|
||||||
(const char *)RDEscapeString(table_q->value(0).toString()));
|
|
||||||
q1=new QSqlQuery(sql);
|
|
||||||
delete q1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MainObject::CleanTables(const QString &ext,QSqlQuery *table_q) const
|
|
||||||
{
|
|
||||||
QString sql;
|
|
||||||
QSqlQuery *q1;
|
|
||||||
|
|
||||||
table_q->seek(-1);
|
|
||||||
while(table_q->next()) {
|
|
||||||
if(table_q->value(0).toString().right(ext.length())==ext) {
|
|
||||||
printf(" Table %s is orphaned -- delete (y/N)? ",
|
|
||||||
(const char *)table_q->value(0).toString());
|
|
||||||
fflush(NULL);
|
|
||||||
if(UserResponse()) {
|
|
||||||
sql=QString().sprintf("drop table %s",
|
|
||||||
(const char *)RDEscapeString(table_q->value(0).toString()));
|
|
||||||
q1=new QSqlQuery(sql);
|
|
||||||
delete q1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool MainObject::IsTableLinked(QSqlQuery *name_q,const QString &ext,
|
|
||||||
const QString &table) const
|
|
||||||
{
|
|
||||||
QString tablename;
|
|
||||||
|
|
||||||
if(table.right(ext.length())!=ext) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
name_q->seek(-1);
|
|
||||||
while(name_q->next()) {
|
|
||||||
tablename=name_q->value(0).toString()+"_"+ext;
|
|
||||||
tablename.replace(" ","_");
|
|
||||||
if(tablename==table) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool MainObject::UserResponse() const
|
bool MainObject::UserResponse() const
|
||||||
{
|
{
|
||||||
char c=0;
|
char c=0;
|
||||||
|
@ -43,9 +43,6 @@ class MainObject : public QObject
|
|||||||
bool Check(QString *err_msg) const;
|
bool Check(QString *err_msg) const;
|
||||||
void RelinkAudio(const QString &srcdir) const;
|
void RelinkAudio(const QString &srcdir) const;
|
||||||
void CheckOrphanedTracks() const;
|
void CheckOrphanedTracks() const;
|
||||||
void CheckClocks() const;
|
|
||||||
void CheckEvents() const;
|
|
||||||
void CheckOrphanedTables() const;
|
|
||||||
void CheckCutCounts() const;
|
void CheckCutCounts() const;
|
||||||
void CheckPendingCarts() const;
|
void CheckPendingCarts() const;
|
||||||
void CheckOrphanedCarts() const;
|
void CheckOrphanedCarts() const;
|
||||||
@ -56,11 +53,6 @@ class MainObject : public QObject
|
|||||||
void RehashCart(unsigned cartnum) const;
|
void RehashCart(unsigned cartnum) const;
|
||||||
void RehashCut(const QString &cutnum) const;
|
void RehashCut(const QString &cutnum) const;
|
||||||
void SetCutLength(const QString &cutname,int len) const;
|
void SetCutLength(const QString &cutname,int len) const;
|
||||||
void CleanTables(const QString &ext,QSqlQuery *table_q,
|
|
||||||
QSqlQuery *name_q) const;
|
|
||||||
void CleanTables(const QString &ext,QSqlQuery *table_q) const;
|
|
||||||
bool IsTableLinked(QSqlQuery *name_q,const QString &ext,
|
|
||||||
const QString &table) const;
|
|
||||||
void RemoveCart(unsigned cartnum);
|
void RemoveCart(unsigned cartnum);
|
||||||
bool CopyFile(const QString &destfile,const QString &srcfile) const;
|
bool CopyFile(const QString &destfile,const QString &srcfile) const;
|
||||||
bool UserResponse() const;
|
bool UserResponse() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user