How do I open an in-memory database file into sqli

2020-02-10 17:55发布

问题:

I'm on a system with no access to disk. My C program has in memory the contents of a valid, small, sqlite3 file (received over the network). I would like to use sqlite3's C API to open and access this file (read-only is fine).

How do I do this? I know I can create an empty in-memory database with

sqlite3_open(":memory:", &foo)

but is there any way to open my existing db? I don't have the privileges to create a ram disk, but perhaps something along those lines? Thanks.

回答1:

Code example here (in C):

http://www.mail-archive.com/sqlite-users@sqlite.org/msg15929.html