On Tue, Nov 2, 2010 at 12:04 PM, Niemann, Hartmut <
[email protected]> wrote:

> Hello *!
>
> I am investigating using sqlite (with Java) as a readonly database in a
> viewer application.
> One problem is that the database can reside not only on the local hard
> disc, but also on a
> possibly slowly connected remote system that can be contacted only via ftp
> or some
> proprietary interface.
>
> I found two solutions.
> I could copy remote databases to a temporary place on the local disk and
> open them there.
> Or I create and fill an in-memory database, but the online backup api uses
> two database
> objects, i.e. it can not read from something that is not
> a database.
>
> Would it also be possible to create an in-memory database and fill it from
> a byte stream or a file?
>

You cannot populate an in-memory database from a data stream.

But you can write a really simple VFS (http://www.sqlite.org/c3ref/vfs.html)
that implements a "filesystem" consisting of a single read-only file
contained in memory, then register this VFS using sqlite3_vfs_register()
then load your remote database into memory that the VFS uses as its one
file.

-- 
D. Richard Hipp
[email protected]
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to