marone42 Posted April 25, 2007 Share Posted April 25, 2007 Hello guys, I have here a Database with a Nested Set (Nested Tree) Structure, with id, lft, rgt, root_id and parent_id. I think that the structure is not ok.I found some duplicate nodes and other inconsistencies. So my question: does anyone of you guys have a hint (or maybe some test algos) for doing an integrity check of the tree? Maybe using the parent_ids (which are assigned correct) or so. Thanks! Link to comment https://forums.phpfreaks.com/topic/48593-integrity-check-for-a-nested-set/ Share on other sites More sharing options...
bubblegum.anarchy Posted April 25, 2007 Share Posted April 25, 2007 for every record the parent_id must match an id in another record. for every record the parent_id must not match the id. for every record the root_id must match an id in another record. Are those the type of hints you are looking for? Link to comment https://forums.phpfreaks.com/topic/48593-integrity-check-for-a-nested-set/#findComment-237945 Share on other sites More sharing options...
marone42 Posted April 25, 2007 Author Share Posted April 25, 2007 Hello, i'm sorry, i wasn't precise enough. I want to check the integrity of the Nested Set structure, which has nothing to do with the parent_ids. Its structure consists only of the left and right nodes. I know that the parent_id-Structure is ok, but this system works mainly with the nodes, i think the parent_id and root_id structure is only in the db for "backup". I'm looking for a script that checks the integrity of the left and right nodes, if all trees are correct, maybe if the tree structure matches the parent_id-structure. Regards Link to comment https://forums.phpfreaks.com/topic/48593-integrity-check-for-a-nested-set/#findComment-238030 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.