-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/10/12 05:47, Chris Sonon wrote:
> I would like to house my database in a ZIP file and extract the
> database to a memory stream and then open it directly from the memory
> stream? Is this possible? If so, how?

You can get a zipvfs from the SQLite team:

  http://www.hwaci.com/sw/sqlite/zipvfs.html

You can do it yourself with the C api - I don't know if the C# wrapper is
fully equivalent.  It is also most likely the the zipvfs from the SQLite
team will be cheaper unless your time is worth nothing.

If you want to do it yourself, there are cheap hacks like extracting to a
temporary file and opening that.  You should also be able to use the
backup API to copy a temporary file to memory.  If temporary files are not
acceptable then you can write a VFS that exposes the zip file.  Again the
backup API can be used to copy the database, or you could just use your
zipvfs directly.

The VFS operates at the level of the database file - for example there are
methods for reading and writing blocks of the files.  SQLite also has a
virtual table mechanism which operates at a higher level - rows and
columns.  You can use SQL while supplying the underlying data to operate
on.  This approach may be more applicable if the data in the zip file is a
higher level.

And lastly you can store SQL in the zip file and just run it against a
memory database.

Roger

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAlBvw1QACgkQmOOfHg372QThPgCfSkQoIF2I9jgQ74hXcs5TasGM
ILYAn0BAEDaiF6PGg49VeXaHf/L7Jfwo
=79RU
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to