Hi,
We have a database that contains several Trees. These trees are build using the "Preorder tree traversal" principle. This is a very powerful way of creating trees but it has one big disadvantage, adding multiple nodes at once.
We have to create a copy function in our tree, copying a single (lowest level) node is very easy, you can do this in one call. But now we want to copy a whole folder at once. We were wondering if we should do this in .net of with a stored procedure. We have to make sure that the transaction works, if anything goes wrong all has to be rollbacked because otherweise the tree will get corrupted.
Anyone who can help me with this? Any info about PTT you can find it here: http://en.wikipedia.org/wiki/Tree_traversal
Edit:
some more information is clearly needed. I have a 2 trees:
Root
Folder 1
Item
Item
Item
Folder 2
Item
Item
Folder 3
Folder 4
Item
Item
Folder 5
Item
Root 2
Folder 6
I want to be able to copy folder 3 underneith folder 6. soo the children need to be copied together with all items. And all the left and rights need to be adjusted properly. If something fails a complete rollback is needed. Hope this is much clearer now.
EDIT2 :
I've written a stored procedure for this. If anyone wants it just ask i'll get back to this question later this day. I'll post it if you want.
Regards, Sem