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; }2.合并sql文件到本地数据库
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);3.下载sql文件部分略用libcurl很容易也很快下载文件 4.备注 1.代码在win7+vs2010+qt5.40+libcurl 7.36.0下编译通过 2.编译或直接下载sqlite3.exe在生成目录和源码目录分别存放一份 3.常识currentPath在编译时是指源码目录,直接运行exe指exe所在目录 总结
以上是内存溢出为你收集整理的sqlite3实现中文路径sql文件导入另类解决方法全部内容,希望文章能够帮你解决sqlite3实现中文路径sql文件导入另类解决方法所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)