More case fixes of filenames.
This commit is contained in:
parent
20af12535e
commit
e71ef2e6df
41 changed files with 258 additions and 123 deletions
66
src/BackupRestore.cpp
Normal file
66
src/BackupRestore.cpp
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
#include <QProcess>
|
||||
#include <QProcessEnvironment>
|
||||
#include "connectionconfig.h"
|
||||
|
||||
void setupEnvironment(const ConnectionConfig &cc)
|
||||
{
|
||||
|
||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||
env.insert("PGHOST", cc.host().c_str());
|
||||
env.insert("PGPORT", QString::number(cc.port()));
|
||||
env.insert("PGDATABASE", cc.dbname().c_str());
|
||||
env.insert("PGUSER", cc.user().c_str());
|
||||
env.insert("PGPASSWORD", cc.password().c_str());
|
||||
|
||||
// QProcess process;
|
||||
// process.setProcessEnvironment(env);
|
||||
// process.start("myapp");
|
||||
|
||||
}
|
||||
|
||||
// QString toolpath;
|
||||
// Executable = toolpath + "\\pg_restore.exe";
|
||||
// ExecutableDump = toolpath + "\\pg_dump.exe";
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void Backup(QString dest_file_name)
|
||||
{
|
||||
|
||||
// QString command_line = "\"" + ExecutableDump + "\" ";
|
||||
// // Add commandline options
|
||||
// command_line += "--verbose ";
|
||||
// command_line += "--format=c "; // user option
|
||||
// command_line += " --file=\"" + dest_file_name + "\"";
|
||||
|
||||
QStringList args;
|
||||
args << "--verbose";
|
||||
args << "--format=c";
|
||||
args << "--file=\"" + dest_file_name + "\"";
|
||||
|
||||
QProcess process;
|
||||
process.setProgram("pg_dump.exe");
|
||||
process.setArguments(args);
|
||||
process.start();
|
||||
|
||||
// process.setProcessEnvironment(env);
|
||||
// process.start("myapp");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void Restore(QString bron_file_name)
|
||||
{
|
||||
QProcess process;
|
||||
process.setProgram("pg_restore.exe");
|
||||
|
||||
// QString command_line = "\"" + ExecutableRestore + "\" ";
|
||||
// command_line += "--verbose --no-password --no-privileges --no-owner --dbname=\"" + DbConfig.DbNaam + "\" \"" + bron_file_name + "\"";
|
||||
|
||||
// ExecProg = new ExecuteProgram;
|
||||
// ExecProg->Startup(command_line, Env.GetRawData(), Handle, WM_USER);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue