2018-05-31 Fred Gleason <fredg@paravelsystems.com>

* Refactored table drops to use 'RDApplication::dropTable()'.
This commit is contained in:
Fred Gleason
2018-05-31 19:11:16 +00:00
parent c6bbac7267
commit 84430a10ef
13 changed files with 58 additions and 101 deletions

View File

@@ -2,7 +2,7 @@
//
// Abstract a Rivendell Service.
//
// (C) Copyright 2002-2004,2016-2017 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2004,2016-2018 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
@@ -20,17 +20,17 @@
#include <qmessagebox.h>
#include <rdapplication.h>
#include <rdclock.h>
#include <rdconf.h>
#include <rdcreate_log.h>
#include <rddatedecode.h>
#include <rddb.h>
#include <rd.h>
#include <rdescape_string.h>
#include <rdlog.h>
#include <rdsvc.h>
#include <rdweb.h>
#include "rdapplication.h"
#include "rdclock.h"
#include "rdconf.h"
#include "rdcreate_log.h"
#include "rddatedecode.h"
#include "rddb.h"
#include "rd.h"
#include "rdescape_string.h"
#include "rdlog.h"
#include "rdsvc.h"
#include "rdweb.h"
//
// Global Classes
@@ -516,10 +516,7 @@ bool RDSvc::import(ImportSource src,const QDate &date,const QString &break_str,
//
// Setup Data Source and Destination
//
sql=QString().sprintf("drop table `%s`",(const char *)dest_table);
QSqlQuery *qq; // Use QSqlQuery so we don't generate a
qq=new QSqlQuery(sql); // spurious error message.
delete qq;
rda->dropTable(dest_table);
sql=QString("create table ")+
"`"+dest_table+"` ("+
"ID int primary key,"+
@@ -976,9 +973,7 @@ bool RDSvc::linkLog(RDSvc::ImportSource src,const QDate &date,
delete dest_event;
// printf("Import Table: %s\n",(const char *)import_name);
sql=QString().sprintf("drop table `%s`",(const char *)import_name);
q=new RDSqlQuery(sql);
delete q;
rda->dropTable(import_name);
delete log_lock;
return true;
@@ -1399,7 +1394,6 @@ void RDSvc::remove(const QString &name)
{
QString sql;
RDSqlQuery *q;
RDSqlQuery *q1;
QString logname;
sql=QString("delete from AUDIO_PERMS where ")+
@@ -1454,12 +1448,8 @@ void RDSvc::remove(const QString &name)
while(q->next()) {
logname=q->value(0).toString();
logname.replace(" ","_");
sql=QString("drop table `")+RDLog::tableName(logname)+"`";
q1=new RDSqlQuery(sql);
delete q1;
sql=QString().sprintf("drop table `%s_REC`",(const char *)logname);
q1=new RDSqlQuery(sql);
delete q1;
rda->dropTable(RDLog::tableName(logname));
rda->dropTable(logname+"_REC");
}
delete q;