问题
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