[zz]Save SQLite memory database to file

阅读更多
http://itsystementwicklung.de/pipermail/list-pysqlite/2008-July/000113.html


I would like to do this for similar reasons.  I have a web application where
the application data will be organized in a sqlite database unique to each
user.  The user will upload the database when he begins a session and
download it when he is done.  I want to manage the data entirely in memory
because

    (a) the database size will be relatively small (on the order of a few
megabytes),

    (b) there will be few users simultaneously using the system,

    (c) I want the data to expire when the user's session expires (which may
occur as a timeout), so I intend to store the sqlite database in the user's
server-side session.

    (d) I don't want to have to find a place to store the data on the disk,
ensure that the permissions are correct, and remove files that have expired.

So, to be specific, I don't want to load/dump the in-memory database to/from
a file, but instead to/from a stream.
It appears the API doesn't support what I'm trying to do.  Do you have any
suggestions on how I might go about saving an in-memory database or
initializing from a previously-saved database without touching the file
system?

I understand I could use the aforementioned file-based technique to
accomplish what I need, but that's a clumsy way to get at the raw data, when
it presumably already exists in memory.


你可能感兴趣的:(SQLite,Flash,MySQL,Social,UP)