Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLite in-memory database backup in .NET

How to get the SQLite in-memory data base backed up? I create the database in my Windows application. I want to take a database backup when I will close the application.

like image 404
Omkar Avatar asked Feb 03 '11 18:02

Omkar


People also ask

Is SQLite A in-memory database?

SQLite in-memory databases are databases stored entirely in memory, not on disk. Use the special data source filename :memory: to create an in-memory database. When the connection is closed, the database is deleted. When using :memory: , each connection creates its own database.

Does SQLite cache in memory?

SQLite provides an in-memory cache which you size according to the maximum number of database pages that you want to hold in memory at any given time. Berkeley DB also provides an in-memory cache that performs the same function as SQLite.

How fast is SQLite in memory?

sqlite or memory-sqlite is faster for the following tasks: select two columns from data (<. 1 millisecond for any data size for sqlite . pandas scales with the data, up to just under 0.5 seconds for 10 million records)


1 Answers

You want the SQLite Online Backup API.

As far as I know, System.Data.SQLite does not support it yet, so you'll need to write some code. The System.Data.SQLite Forum contains an example: http://sqlite.phxsoftware.com/forums/t/2403.aspx. As noted, when you patch System.Data.SQLite and call SQLite directly you do so at your own risk.

like image 93
Corbin March Avatar answered Oct 09 '22 12:10

Corbin March