>Is there any way to load a sqlite3 db from a location in memory? >Ideally, I'd like to have a memory pointer (eg, something provided via >malloc), which I could then use as the handle sqlite3 uses to load the >database. > >The reason I'm trying to do this: I have an encrypted database file >that I will copy into memory, decrypt, and then process. I would like >to do this entirely in memory (no unencrypted files on the HD) to >reduce the likelihood of casual users snooping in the db file.
You can use the backup API to make a copy of the disk DB to a :memory: DB and work on this one. You won't have any memory housekeeping to do: everything is handled by SQLite. Drawback or advantage, depending on your precise context: you can't share your memory DB with other processes. As I understand it, you won't be using the disk DB by itself, so you can "backup" the baby in one shot as there is no concurrency in your situation. This can be made to work in only a handful of simple calls to the SQLite API. Another possibility is use some RAMdisk driver for your OS and copy the disk file there, but then be aware that it might then be easier for curious people to dissect your DB. To overcome this, you'll need to wipe the RAMdisk file as well, adding more complexity to your code. I'd favor the backup way, much simpler. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users