Subhadeep Ghosh wrote:
> I am aware of the functionality which you mentioned. But the reason why
> I ended up coding the feature was because of a very specific requirement.
> My requirement was such that some of my client applications were running
> on disk-less systems where I was not using any kind of network storage.
> But my applications used SQLite. So I coded the below mentioned feature
> such that the database was being stored on the server and when the
> disk-less clients wanted to use them, they fetched the database from the
> server over the network and directly create a database out of the fetched
> data (basically serializing and de-serializing the database).
>
> I am guessing that SQLite does not support such functionality. The
> closest thing would have been to fetch the database over the network,
> store it in a file (which in this case is not possible) and then open the
> database.
>
> I maybe wrong, but if such a feature already exists then I would be more
> than happy to adopt it in my code.
I see.
Firstly, you may be better off using a client/server db, since that
seems to map more naturally into your use-case. But let's forget about
that for the moment.
Had I written your application, I first would have considered dumping
the original database to raw SQL text and reading it into the in-mem
db on the other end. That would be pretty trivial to do, and if it
suits your needs perf-wise, you're golden. This also gives the extra
advantage of having a textual communication format between the master
and the slave, which can be a useful debugging tool.
I would then have considered using a RAM-backed filesystem on the
slave. You can copy the sqlite db as-is to the slave and open it
using normal sqlite api calls. SQLite and your app think the db is
disk-backed because the OS is faking the existence of a disk. Whether
this option works well depends on how easy it is to get a ram-backed fs
up and running on your slave. (In linux this is very easy, not sure
about your deployment oS.)
Eric
--
Eric A. Smith
The people can always be brought to the bidding of the leaders. That
is easy. All you have to do is tell them they are being attacked and
denounce the pacifists for lack of patriotism and exposing the
country to danger. It works the same way in any country.
-- Herman Goering, at the Nuremberg trials
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users