How to backup/store between sqlite memory database and file database in Qt?

笑着哭i 提交于 2021-01-29 05:57:04

问题


What's the easiest way to backup/restore sqlite memory database to file database in Qt.


回答1:


I think you will need to work with SQLite directly to do this. SQLite has an Online Backup API, the first example is backing up an in-memory database to a file database, so it should be possible to do what you need to do.

To get a sqlite3* database handle, get the driver (QSqlDatabase::driver) from the database then get the handle (QSqlDriver::handle). The example code in the Qt docs shows how to cast the QVariant into a sqlite3* handle.



来源:https://stackoverflow.com/questions/8726985/how-to-backup-store-between-sqlite-memory-database-and-file-database-in-qt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!