I am/was doing this in application, with 2.8.15 .  I simply attached
the on-disk database to the memory, and then wrote a bunch of dump
queries to drop the memory data to disk (from the memory db
connection):

ATTACH 'C:\my_database_on_disk.sqlitedb' AS diskdb ;

Unfortunately, I don't think you can execute transactions on the
attached database in 2.8.15, and I couldn't think of a way to attach
to the memory database from the disk database.  I think you can
execute transactions on the attached db in 3.x, though.

It works ok, although since I was using the in-memory database as a
preliminary db (multithreaded app), my dump queries got ugly, and
quite slow on large sets, because I had to do the checks to ensure
that the in-memory db wasn't dumping data that already existed in the
database (I know, triggers, etc., but I hadn't tried those yet, and
INSERT OR IGNORE scares me).  I eventually substituted writing text
sql scripts to disk, and then executing those directly into the disk
database, which saved me 25-30% of the insert time.

--Keith

On Fri, 18 Feb 2005 04:01:32 +0100, chorlya <[EMAIL PROTECTED]> wrote:
> I gues you could attach in-memory db to a newly created disk db and
> then do something like
> 
> CREATE TABLE newDiskTbl AS SELECT * FROM memoryTbl
> 
> Take a look at http://www.sqlite.org/lang_createtable.html for more details
> 
> Regards,
> chorlya
> 
> On Fri, 18 Feb 2005 11:13:40 +1100, [EMAIL PROTECTED]
> <[EMAIL PROTECTED]> wrote:
> >
> > I have a situation where I start with an in-memory DB, then need to save the
> > entire thing to a new disk DB.  Does anyone know the best way to do this?
> > Would I attach the memory DB to a newly created disk DB?  Is this even
> > possible?  I notice the COPY command is not supported in 3.x according to 
> > the
> > documentation on the website, so even if I could attach it I would still 
> > need a
> > way to copy the tables.  Any suggestions would be greatly appreciated.
> >
> > TIA
> > -brett
> >
> > ----------------------------------------------------------------
> > This message was sent using IMP, the Internet Messaging Program.
> >
> >
> 


-- 
******************************************************
- Ever notice how 'big' isn't, compared to 'small'?

- Sounds like a Wookie; acts like mad cow.

- I'm not a professional; I just get paid to do this.

- Rules for programming:
   1.  Get it working, right?
   2.  Get it working right.

- Things I've learned about multithreaded programming:

    123...   PPArrvooottieedcc ttm  ueelvvteeirrtyyhtt
rhheiianndgge  dwi hnpi rctohhg eri aslm omscitanalgt 
 iowcbh,je engceltvo ebwrah lip,co hso srci abonlt ehb
.ee^Nr waicscee snsoetd  'aotb jtehcet -slaomcea lt'il
m^Ne from two or more threads
******************************************************

Reply via email to