Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+62
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* @RDE_HEADER@
|
||||
* Copy exercise from server to evaluation server
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, NLSE, 2018-07-31
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QProcess>
|
||||
|
||||
#include "logger.h"
|
||||
|
||||
namespace OcBaseDownload
|
||||
{
|
||||
class CopyDatabase : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CopyDatabase(NGL::INGLLogger &logger, QObject *parent = nullptr);
|
||||
|
||||
bool init(const QString &dbHost, const QString &srcDbName, const QString &dstDbName);
|
||||
bool doCopy();
|
||||
|
||||
bool dropDatabase(const QString &dbName);
|
||||
|
||||
Q_SIGNALS:
|
||||
void copyDbFailed();
|
||||
void copyDbFinished();
|
||||
void dropDatabaseFailed();
|
||||
void dropDatabaseFinished();
|
||||
private:
|
||||
bool runDropDb(const QString &dbName);
|
||||
void onDropDbFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void runGrant();
|
||||
bool runPgDump();
|
||||
void onPgDumpFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void runCreatedb();
|
||||
void onCreateDbFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void runPgLoad();
|
||||
void onPgLoadFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void runPgSetGrant();
|
||||
void onPgSetGrantFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
QString getDumpFile() const;
|
||||
|
||||
void handleProcInit(const QString &program, const QStringList &args);
|
||||
void handleProcFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void onErrorOccured(QProcess::ProcessError error);
|
||||
|
||||
QString executablePath(const QString &program);
|
||||
private:
|
||||
QString m_dbHost;
|
||||
QString m_srcDbName;
|
||||
QString m_dstDbName;
|
||||
QProcess *m_proc;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
} // namespace OcBaseDownload
|
||||
Reference in new issue
Block a user