QString strdbpath(QDir::currentPath() + "/db");
QDir dir("");
dir.mkpath(strdbpath);
strdbpath += "/mysqlite.db";
QSqlDatabase dbset = QSqlDatabase::addDatabase("QSQLITE", "file");
dbset.setDatabaseName(strdbpath);
if (!dbset.open()) {
LOG_ALL_ERROR(QStringLiteral("failed open mysqlite.db"));
return bret;
}
std::string strstdcmd("sqlite3.exe ./db/mysqlite.db \".read ./db/mysqlite.sql\"");
QProcess process;
process.start(strstdcmd.c_str());
process.waitForFinished();
String strsqlpath(QDir::currentPath() + "/db/mysqlite.sql");
QFile::remove(strsqlpath);
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/zhang_ruiqiang/article/details/47974381