FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=12341&edit=1

ID: 12341
Updated by: khan@php.net
Reported By: k dot bizuns at inbox dot lv
Summary: Bug with root nodes
-Status: Open
+Status: Bogus
Type: Bug
Package: DB_NestedSet
Operating System: Irrelevant
Package Version: 1.4.0RC1
PHP Version: Irrelevant
Roadmap Versions:
New Comment:

-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.


Previous Comments:
------------------------------------------------------------------------

[2007-10-25 04:06:52] analgiins

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

------------------------------------------------------------------------

Search Discussions

  • Khan at Apr 24, 2010 at 7:35 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=12341&edit=1

    ID: 12341
    Updated by: khan@php.net
    Reported By: k dot bizuns at inbox dot lv
    Summary: Bug with root nodes
    -Status: Bogus
    +Status: Duplicate
    Type: Bug
    Package: DB_NestedSet
    Operating System: Irrelevant
    Package Version: 1.4.0RC1
    PHP Version: Irrelevant
    Roadmap Versions:
    New Comment:

    -Status: Bogus
    +Status: Duplicate
    #13166


    Previous Comments:
    ------------------------------------------------------------------------

    [2010-04-24 20:24:13] 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.

    ------------------------------------------------------------------------

    [2007-10-25 04:06:52] analgiins

    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

    ------------------------------------------------------------------------
  • Khan at Apr 25, 2010 at 1:27 am
    Edit report at http://pear.php.net/bugs/bug.php?id=12341&edit=1

    ID: 12341
    Updated by: khan@php.net
    Reported By: k dot bizuns at inbox dot lv
    Summary: Bug with root nodes
    -Status: Duplicate
    +Status: Bogus
    Type: Bug
    Package: DB_NestedSet
    Operating System: Irrelevant
    Package Version: 1.4.0RC1
    PHP Version: Irrelevant
    Roadmap Versions:
    New Comment:

    -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.


    Previous Comments:
    ------------------------------------------------------------------------

    [2010-04-24 20:29:22] khan

    -Status: Bogus
    +Status: Duplicate
    #13166

    ------------------------------------------------------------------------

    [2010-04-24 20:24:13] 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.

    ------------------------------------------------------------------------

    [2007-10-25 04:06:52] analgiins

    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

    ------------------------------------------------------------------------

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedApr 24, '10 at 7:30p
activeApr 25, '10 at 1:27a
posts3
users1
websitepear.php.net

1 user in discussion

Khan: 3 posts

People

Translate

site design / logo © 2022 Grokbase