I would be in favour of this, specifically to allow shared memory
database access. 

-----Original Message-----
From: Cariotoglou Mike [mailto:[EMAIL PROTECTED] 
Sent: 01 December 2005 00:18
To: sqlite-users@sqlite.org
Subject: [sqlite] Feature request

Hi all. I would like to propose an enchancement in sqlite. I am not sure
whether the issue has come up before, if it has, and has been shot down,
pls let me know.

The concept of in-memory database would be greatly enhanced if there was
a mechanism to serialize the internal cache to/from a stream (not
necessarily a disk stream). In-memory databases are extremely useful for
a number of applications, but ar a PITA to initalize/persist.

one might argue why such a mechanism would be useful. If I need a
persistent database, you could say, then I would make it a disk-based
one. Not so. Consider the case where you would like to store the
contents of an entire "database" as part of another storage structure.
consider the case where an entire sqlite database was a field in another
RDBMS. consider OO databases. Consider case tool implementation. The
applications would be endless.

I took a look at the ":memory:" implementation, and it seems to me that
this enchancement would be trivial, consisting of maybe 10-20 c code
lines, for somebody who understands the internal structures involved.
unfortunately, I do not do C, so I cannot do this myself.
OTOH, given the extreme usefuleness of what I propose (IMHO), could you
consider this as a permament addition in sqlite?

the design I have in mind would be something like this:

int sqlite3_loadMemDb(sqlite3 * db,reader) int sqlite3_saveMemDb(sqlite3
* db,writer)

where "reader" and "writer" are function pointers with a signature like
:
 int reader(void mem, int size)

(excuse my attempt at C syntax, this is meant only as a tip)

I suspect that the "load" function might need to know the number of
pages beforehand, so some kind of overloaded definiton of "reader" would
be required, that would return this information. if we agree that the
idea has merit, the details can be worked out easily.

what does the community, and especially DRH, think about this ?




Reply via email to