Really, there's nothing to change.  No triggers, procs, magic, or
anything.  Delete a record, and nothing in the tree gets orphaned. 
Say you've got a table like this:

Name Left Right
food 1 8
fruit 2 7
apple 3 4
banana 5 6

That is, food has a child fruit, which has two children apple and
banana.  Now delete fruit.  Apple and banana are still inside the food
set, without changing anything.

Say you have the same tree, but with an adjacency list:

name parent
food NULL
fruit food
apple fruit
banana fruit

Now if you delete fruit, apple and banana are suddenly parentless, and
they have no connection to food at all.  Or they might have been
inadvertantly deleted as well, if you've got a FOREIGN KEY with
CASCADE DELETE set on the parent field.

cheers,
barneyb

On 1/31/06, Andy Matthews <[EMAIL PROTECTED]> wrote:
> Ah...
>
> Not with the setup I have then. I'm not using triggers or stored procs.
>
> <!----------------//------
> andy matthews
> web developer
> ICGLink, Inc.
> [EMAIL PROTECTED]
> 615.370.1530 x737
> --------------//--------->
>
> -----Original Message-----
> From: Barney Boisvert [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, January 31, 2006 2:36 PM
> To: CF-Talk
> Subject: Re: Nested Set Model
>
>
> Not with a nested set, only with an adjacency list.  With a nested
> set, if you delete an ancestor, the decendants just move up a level
> with no DB modification.
>
> cheers,
> barneyb
>
> On 1/31/06, Andy Matthews <[EMAIL PROTECTED]> wrote:
> > If you deleted an element, any children (and children of children) would
> > become orphans. So you'd at least have to change the association of the
> > child of the deleted record.
> >
>
> --
> Barney Boisvert
> [EMAIL PROTECTED]
> 360.319.6145
> http://www.barneyb.com/
>
> Got Gmail? I have 100 invites.
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:230900
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to