As far as I know, there are no built-in functions for System.Data.SQLite.dll. However, functionality exists in the sqlite3.exe client, which is supported with the SQLite kernel.
Here is how I would do it with system.data.sqlite.dll:
Get SQL statements to create a new database structure.
select sql from sqlite_master where name not like 'sqlite_%';
Get the names of all user tables.
select name from sqlite_master where type='table' and name not like 'sqlite_%';
Create a database on disk in some new SQLiteConnection.
Executing all previously received SQL statements to create the database structure in the database on disk.
Close the separate database connection on disk.
Attach the database on disk to the database in memory.
attach 'ondisk.db3' as 'ondisk';
For each user table obtained earlier, copy the contents from memory to the database on disk.
insert into ondisk.TableX select * from main.TableX; insert into ondisk.TableY select * from main.TableY;
user610650
source share