Hi to all,
it's driving me crazy, trust me. Let me show you the code:
void frmMain::dumpSqliteDatabase()
{
strPathSqlite
= QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/data/sqlite3.exe");
strPathSqlite.replace("\\","\\\\");
p.start(strPathSqlite + " Scrab.db .dump > " + fileName);
if (!p.
waitForStarted() ||
!p.
waitForFinished(-1) ||
(p.
exitStatus() != QProcess::NormalExit)) {
switch (p.error())
{
strError = tr("The process failed to start. Either the invoked "
"program is missing, or you may have insufficient permissions to invoke the program.");
break;
strError = tr("The process crashed some time after starting successfully.");
break;
strError = tr("An error occurred when attempting to write to the process. For example, the process may not be running, or it may have closed its input channel.");
break;
strError = tr("An error occurred when attempting to read from the process. For example, the process may not be running.");
break;
default:
strError = tr("An unknown error occurred.");
}
msgBox.setWindowTitle(tr("!!!"));
msgBox.setText(strError);
msgBox.exec();
}
}
void frmMain::dumpSqliteDatabase()
{
QString strError;
QString strPathSqlite;
QString fileName = "Dump.sql";
QProcess p;
strPathSqlite = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/data/sqlite3.exe");
strPathSqlite.replace("\\","\\\\");
p.start(strPathSqlite + " Scrab.db .dump > " + fileName);
if (!p.waitForStarted() || !p.waitForFinished(-1) || (p.exitStatus() != QProcess::NormalExit))
{
switch (p.error())
{
case (QProcess::FailedToStart) :
strError = tr("The process failed to start. Either the invoked "
"program is missing, or you may have insufficient permissions to invoke the program.");
break;
case (QProcess::Crashed) :
strError = tr("The process crashed some time after starting successfully.");
break;
case (QProcess::WriteError) :
strError = tr("An error occurred when attempting to write to the process. For example, the process may not be running, or it may have closed its input channel.");
break;
case (QProcess::ReadError):
strError = tr("An error occurred when attempting to read from the process. For example, the process may not be running.");
break;
default:
strError = tr("An unknown error occurred.");
}
QMessageBox msgBox;
msgBox.setWindowTitle(tr("!!!"));
msgBox.setIcon(QMessageBox::Warning);
msgBox.setText(strError);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.exec();
}
}
To copy to clipboard, switch view to plain text mode
I've tested the same command(C:\data>sqlite3 Scrab.db .dump > Dump.sql) in the windows 7 shell and it works, but the above code doesn't create the dumped file!
Thanks in advance for yuor help.
Bookmarks