On Feb 14, 2006, at 1:31 PM, Jeff Ayling wrote:
On 14/02/2006, at 10:46 PM, Jeff Ayling wrote:
On 14/02/2006, at 10:22 PM, Marco Bambini wrote:
Hi Jeff,
the best solution is to attach the file based db to the in memory
db and then do a cross insert/select, like:
INSERT INTO fileDB.test1 select * from test1
// Dump all records from memory to disk
memDB.SQLExecute("BEGIN TRANSACTION")
memDB.SQLExecute("INSERT INTO fileDB.test1 select * from test1")
memDB.Commit
memDB.DetachDatabase("myFileDB")
In the INSERT above are there restrictions to the comp of select?
Eg, I'm having trouble getting the following to work:
memDB.SQLExecute("INSERT INTO fileDB.trax select * from trax As t1,
playlistdata As t2 where t2.Playlist_Persistent_ID IN (1,2,3,4) and
t2.Track_ID=t1.Track_ID and t1.web_enabled='Y'"
Don't worry too much about the details of my actual select - it has
been working fine on it's own but it's now not working with this
new system.
I have also tried the following without success either:
memDB.SQLExecute("INSERT INTO fileDB.trax select * from memDB.trax
As t1, memDB.playlistdata As t2 where t2.Playlist_Persistent_ID IN
(1,2,3,4) and t2.Track_ID=t1.Track_ID and t1.web_enabled='Y'"
The following works great:
memDB.SQLExecute("INSERT INTO fileDB.trax select * from trax"
As far as I know (I am not an SQL guru) there isn't any restriction
in the complexity of select, but (from sqlite web site):
The number of columns in the result of the SELECT must exactly match
the number of columns in the table if no column list is specified, or
it must match the number of columns name in the column list. A new
entry is made in the table for every row of the SELECT result. The
SELECT may be simple or compound. If the SELECT statement has an
ORDER BY clause, the ORDER BY is ignored.
Please take a look here:
http://www.sqlite.org/lang_insert.html
and here:
http://www.sqlite.org/lang_attach.html
---
Marco Bambini
http://www.sqlabs.net
http://www.sqlabs.net/blog/
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>