Fred Gleason 7133d0f388 2018-06-01 Fred Gleason <fredg@paravelsystems.com>
* Stubbed out rddbmgr(8).
	* Implemented the '--create' command in rddbmgr(8).
	* Fixed a bug in 'RDStation::create()' that generated corrupt records
	in the 'AUDIO_INPUT' and 'AUDIO_OUTPUTS' tables when creating a
	new host with no exemplar.
2018-06-01 23:23:58 +00:00

63 lines
1.9 KiB
C++

// rddbmgr.h
//
// Rivendell database management utility
//
// (C) Copyright 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
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#ifndef RDDBMGR_H
#define RDDBMGR_H
#include <qobject.h>
#include <rdconfig.h>
#define RDDBMGR_USAGE "[options]\n"
class MainObject : public QObject
{
public:
enum Command {NoCommand=0,ModifyCommand=1,CreateCommand=2,CheckCommand=3};
MainObject(QObject *parent=0);
private:
bool Check(QString *err_msg) const;
bool Create(const QString &station_name,bool gen_audio,
QString *err_msg) const;
bool CreateNewDb(QString *err_msg) const;
bool InititalizeNewDb(const QString &station_name,bool gen_audio,
QString *err_msg) const;
bool RunQuery(QString sql) const;
void InsertImportFormats() const;
bool InsertRDAirplayHotkeys(const QString &station_name) const;
bool Modify(QString *err_msg,int set_schema,const QString &set_version) const;
Command db_command;
QString db_mysql_hostname;
QString db_mysql_loginname;
QString db_mysql_password;
QString db_mysql_database;
QString db_mysql_driver;
QString db_mysql_engine;
QString db_mysql_charset;
QString db_mysql_collation;
bool db_verbose;
QString db_table_create_postfix;
RDConfig *db_config;
};
#endif // RDDBMGR_H