views:

1419

answers:

1

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.

+5  A: 

Code example here (in C):

http://www.mail-archive.com/[email protected]/msg15929.html

ChristopheD
That was useful, although (for anybody else reading this later), the actual code is in:http://www.mail-archive.com/[email protected]/msg15905.htmlI unfortunately won't actually be able to use this as my program is really in python (running on the "google app engine", which doesn't allow C extensions) using python's interface to sqlite... I used C in my question to try to simplify the issue. Thanks.
update 2: apparently the google app engine's python environment doesn't even have the sqlite3 module, so the motivation behind my original question was pointless
Why would you explicitly say, "I would like to use sqlite3's C API" when you are using Python?
Matthew Flaschen
Because anything done in python would also be possible in C and not vice-versa? I knew this was a long-shot so I wanted to cast as wide a net as possible. The C solution might still come in handy to me in the future.