On 5/7/15, Paul Sanderson <sandersonforensics at gmail.com> wrote: > I am contemplating a change to a program whereby a database is > initailly created in memory and then later if my users choose they can > save it to disk and then switch to using the disk based DB. > > I can obviously create a new disk based db, iterate through > sqlite_master and then populate each table. But I just wondered > whether anyone had any suggestions of a better way of doing this? >
Use the backup API (https://www.sqlite.org/backup.html) to make a copy of the in-memory database over into a disk database. The ".backup" command in the command-line shell provides you with a sample implementation. -- D. Richard Hipp drh at sqlite.org