Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.4.1

Bug #12341 Bug with root nodes
Submitted: 2007-10-25 08:06 UTC
From: analgiins Assigned:
Status: Bogus Package: DB_NestedSet (version 1.4.0RC1)
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 46 + 35 = ?

 
 [2007-10-25 08:06 UTC] analgiins (Kaspars Bizuns)
Description: ------------ Clear table. Create one root node: root_1. For this node left (L) is 1 and right is 2. Everything is ok. Create second root node: root_2. For this node L is 1 and R is 2 (the same as first). So, again everything is ok. Now create one sub node under root_1, for example sub_node_1. For root_1: L = 1, R = 4. Ok. For sub_node_1: L = 2, R = 3. Ok. For root_2: L = 1, R = 4. Not ok. root_2 doesn't hold any children so R for the root_2 must be 2. I fix this bug in this way. In four funciton (createSubNode, createLeftNode, createRightNode, deleteNode) where are generating UPDATE queries wiht sprintf I remove checking for root nodes. In SQL part it's like: WHERE %s=%s, but in sprintf arguments it's like $this->flparams['rootid'], $thisnode['rootid'], In createSubNode - one Update query In createLeftNode - two Update queries In createRightNode - one Update query where comment are // Update all nodes which have dependent left and right values And in deleteNode - one Update query where comment are // The node isn't a rootnode so close the gap Kaspars Bizuns

Comments

 [2010-04-25 00:24 UTC] khan (Daniel Khan)
-Status: Open +Status: Bogus
Can not reproduce and hasn't happened to us in any project. So bogus for now but I will keep an eye on it.
 [2010-04-25 00:29 UTC] khan (Daniel Khan)
-Status: Bogus +Status: Duplicate
#13166
 [2010-04-25 06:22 UTC] khan (Daniel Khan)
-Status: Duplicate +Status: Bogus
It results in this here: function test_12341_rootnode_leftright_bug() { $this->_NeSe->setSortMode(NESE_SORT_PREORDER); $values = array(); $values['STRNA'] = 'root_1'; $root_1 = $this->_NeSe->createRootnode($values); $values['STRNA'] = 'root_2'; $root_2 = $this->_NeSe->createRootnode($values); $tree = $this->_NeSe->getAllNodes(true); $this->_indentTree($tree); $values['STRNA'] = 'sub_root_1'; $sub_root_1 = $this->_NeSe->createSubNode($root_1, $values); $tree = $this->_NeSe->getAllNodes(true); $this->_indentTree($tree); } - 01-04 [01|01|13] | root_1 (13) -- 02-03 [02|01|13] | sub_root_1 (15) - 01-02 [01|02|14] | root_2 (14) Works.