Re: [sqlite] in-memory database bound to a named buffer

2007-03-30 Thread drh
Ryan Underwood <[EMAIL PROTECTED]> wrote:
> Is it possible to bind an in-memory sqlite database (in read-only mode,
> naturally) to an existing named memory buffer that contains exactly the
> contents of a sqlite database file?
> 
> What I want to do is maintain a database as usual, but then take an
> occasional snapshot, bin2c it and include it in my
> (platform/OS-independent) project.
> 
> I looked for functions that would take a mmap'd file (which would be
> equivalent), but didn't see anything...
> 

The whole file-system interface is pluggable - at runtime
if you compile with -DSQLITE_ENABLE_REDEF_IO, or at compile-time
by default.  Three different interface modules come with the
code: Unix, Win32, and OS/2.  It is not that much trouble to
write a new one for your in-process read-only database.  Use
the other three OS interface modules as your guide.  You can 
skip most of the implementation since you only need read-only.

--
D. Richard Hipp  <[EMAIL PROTECTED]>


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] in-memory database bound to a named buffer

2007-03-30 Thread Ken
short answer is no.
 
 The memory structures are not identical to disk structures.
 

Ryan Underwood <[EMAIL PROTECTED]> wrote: 
Is it possible to bind an in-memory sqlite database (in read-only mode,
naturally) to an existing named memory buffer that contains exactly the
contents of a sqlite database file?

What I want to do is maintain a database as usual, but then take an
occasional snapshot, bin2c it and include it in my
(platform/OS-independent) project.

I looked for functions that would take a mmap'd file (which would be
equivalent), but didn't see anything...

-- 
Ryan Underwood, 

-
To unsubscribe, send email to [EMAIL PROTECTED]
-