I am using System.Data.SQLite.dll
to make use of the SQLite in-memory database. After the program finishes, I would like to dump the in-memory database into a .db3 file for next use. How can I achieve this in C#?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
To the best of my knowledge there is not built-in functionality to accomplish this in System.Data.SQLite.dll. The functionality does however exist in the sqlite3.exe client maintained along with the SQLite core.
This is how I would do it with system.data.sqlite.dll:
Obtain SQL statements to create new database structure.
Obtain names of all user tables.
Create the on-disk database in some new SQLiteConnection.
Execute all previously obtained SQL statements to create the database structure in the on-disk database.
Close the separate connection to the on-disk database.
Attach the on-disk database to the in-memory database.
For each user table obtained earlier, copy the content from the in-memory to the on-disk database.