Re: [sqlite] sql optimization question

2008-01-21 Thread Jay Sprenkle
On Jan 20, 2008 9:16 PM, Ken <[EMAIL PROTECTED]> wrote: > Jay > > I've used a trigger to do this with good success. > > You'll need one trigger per table to cause the delete to cascade through > the tree. > > Or if you know that you will always delete from the top level tree"parent" > then

Re: [sqlite] sql optimization question

2008-01-21 Thread Jay Sprenkle
> In response to the deletion of (0,null), the trigger fired, deleting > (1,0), and (2,0). But the trigger didn't fire again in response to > either of these subsequent deletions, so (3,1) was not automatically > deleted. > > If anyone knows how to get around this problem, I would like to know.

Re: [sqlite] sql optimization question

2008-01-20 Thread Andy Goth
On Sun, 20 Jan 2008 19:16:03 -0800 (PST), Ken wrote > Jay Sprenkle <[EMAIL PROTECTED]> wrote: >> I'm deleting a tree of data stored in sqlite and was looking for the >> most efficient way to do it. > > You'll need one trigger per table to cause the delete to cascade > through the tree. Watch out.

Re: [sqlite] sql optimization question

2008-01-20 Thread Ken
Jay I've used a trigger to do this with good success. You'll need one trigger per table to cause the delete to cascade through the tree. Or if you know that you will always delete from the top level tree"parent" then just one trigger would probably suffice. Ken Jay

[sqlite] sql optimization question

2008-01-18 Thread Jay Sprenkle
I'm deleting a tree of data stored in sqlite and was looking for the most efficient way to do it. I thought the best solution was to delete the row and then delete all the orphaned rows the referenced it in a loop delete from category where id = 5; To delete the orphaned rows I repeat one of the

Re: [sqlite] SQL optimization

2005-02-23 Thread Dennis Cote
Cory Nelson wrote: Hello folks. I currently have a table: create table t_gloss(entryid integer, type integer, value text); and am running this SQL on it: select entryid,type from t_gloss where value=?; then for each row returned (type is type==0?1:0 from above row, and entryid is the same): select

[sqlite] SQL optimization

2005-02-23 Thread Cory Nelson
Hello folks. I currently have a table: create table t_gloss(entryid integer, type integer, value text); and am running this SQL on it: select entryid,type from t_gloss where value=?; then for each row returned (type is type==0?1:0 from above row, and entryid is the same): select value from