I'm afraid you cannot do that. And I do not recommend that, Why don't you just increase the cache size?
An SQLite database is normally stored in a single ordinary disk file.
However, in certain circumstances, the database might be stored in
memory.
The most common way to force an SQLite database to exist purely in
memory is to open the database using the special filename ":memory:".
In other words, instead of passing the name of a real disk file into
one of the sqlite3_open(), sqlite3_open16(), or sqlite3_open_v2()
functions, pass in the string ":memory:". For example:
And every connection to SQlite creates a seperated new database.
rc = sqlite3_open(":memory:", &db); When this is done, no disk file is
opened. Instead, a new database is created purely in memory. The
database ceases to exist as soon as the database connection is closed.
Every :memory: database is distinct from every other. So, opening two
database connections each with the filename ":memory:" will create two
independent in-memory databases.
If you are going to implement such a thing, there are not any official way to do it! But you can:
- Open a new in-memory db
- Copy all data from file db to memory
- Compare and merge new/deleted/updated data from memory to disk
Here is code in C language as an example for opening a SQLite file as an in-memory:
https://www.mail-archive.com/[email protected]/msg15929.html