You are viewing a plain text version of this content. The canonical link for it is here.
Posted to zeta-issues@incubator.apache.org by "Suwandi Tanuwijaya (Created) (JIRA)" <ji...@apache.org> on 2011/12/06 19:33:39 UTC

[jira] [Created] (ZETACOMP-104) Database component for sqlabstraction which is query.php has a serious bug

Database component for sqlabstraction which is query.php has a serious bug
--------------------------------------------------------------------------

                 Key: ZETACOMP-104
                 URL: https://issues.apache.org/jira/browse/ZETACOMP-104
             Project: Zeta Components
          Issue Type: Bug
          Components: Database
         Environment: Ubuntu Natty - AMD Athlon X2
            Reporter: Suwandi Tanuwijaya


Database component which is on sqlabstraction folder ( query.php ) has a serious bug. Private properties  of boundValues and boundParameters give an irk problem. they persisted ! somehow, reset method on inherited class cannot fully reset this variables. 

My quick fix is, just set those properties to protected attribute, and case closed :)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (ZETACOMP-104) Database component for sqlabstraction which is query.php has a serious bug

Posted by "Suwandi Tanuwijaya (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZETACOMP-104?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Suwandi Tanuwijaya updated ZETACOMP-104:
----------------------------------------

    Description: 
Database component which is on sqlabstraction folder ( query.php ) has a serious bug. Private properties  of boundValues and boundParameters give an irk problem. they persisted ! somehow, reset method on inherited class cannot fully reset this variables. 

My quick fix is, just set those properties to protected attribute, and case closed :)

ADDED: 

I attached my failed test if those properties still in private attribute. ( I am using Simpletest on this case ). My test failed on QuerySelectImpl on testingBindInteger section with some value on previous test - testingBindString - carried with, even if I'd already reset it.

this is the simpletest code:

{{{
...
function testingBindString()
    {
        $expected = 2;
        
        $section = 'Norway';
        
        $this->q->select( 'COUNT(*)' )
                ->from( 'query_test' )
                ->where( $this->e->eq( 'section', $this->q->bindParam( $section ) ) );
        
        $statement = $this->q->prepare();
        $statement->execute();
        
        $this->assertEqual( $expected, (int) $statement->fetchColumn(0)  );
        
        $expected = 1;
        $section = 'Ukraine';
        $statement = $this->q->prepare();
        $statement->execute();
        
        $this->assertEqual( $expected, (int) $statement->fetchColumn(0)  );
        
        /* $this->dump( $q->getQuery() ); */
        /* $this->dump($this->e); */
    }
    
    function testingBindInteger()
    {
        $expected = 7;
        
        $num = 0;
        $q = $this->q;
        $e = $this->e;
        
        $q->select( 'COUNT(*)' )
          ->from( 'query_test' )
          ->where( $e->gt( 'employees', $q->bindParam( $num ) ) );
        
        $statement = $q->prepare();
        $statement->execute();
        
        $this->assertEqual( $expected, (int) $statement->fetchColumn(0)  );
        
        $expected = 3;
        
        $num = 100;
        $statement = $q->prepare();
        $statement->execute();
        $this->assertEqual( $expected, (int) $statement->fetchColumn(0)  );
    }
...
}}}



  was:
Database component which is on sqlabstraction folder ( query.php ) has a serious bug. Private properties  of boundValues and boundParameters give an irk problem. they persisted ! somehow, reset method on inherited class cannot fully reset this variables. 

My quick fix is, just set those properties to protected attribute, and case closed :)

    
> Database component for sqlabstraction which is query.php has a serious bug
> --------------------------------------------------------------------------
>
>                 Key: ZETACOMP-104
>                 URL: https://issues.apache.org/jira/browse/ZETACOMP-104
>             Project: Zeta Components
>          Issue Type: Bug
>          Components: Database
>         Environment: Ubuntu Natty - AMD Athlon X2
>            Reporter: Suwandi Tanuwijaya
>              Labels: patch, test
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> Database component which is on sqlabstraction folder ( query.php ) has a serious bug. Private properties  of boundValues and boundParameters give an irk problem. they persisted ! somehow, reset method on inherited class cannot fully reset this variables. 
> My quick fix is, just set those properties to protected attribute, and case closed :)
> ADDED: 
> I attached my failed test if those properties still in private attribute. ( I am using Simpletest on this case ). My test failed on QuerySelectImpl on testingBindInteger section with some value on previous test - testingBindString - carried with, even if I'd already reset it.
> this is the simpletest code:
> {{{
> ...
> function testingBindString()
>     {
>         $expected = 2;
>         
>         $section = 'Norway';
>         
>         $this->q->select( 'COUNT(*)' )
>                 ->from( 'query_test' )
>                 ->where( $this->e->eq( 'section', $this->q->bindParam( $section ) ) );
>         
>         $statement = $this->q->prepare();
>         $statement->execute();
>         
>         $this->assertEqual( $expected, (int) $statement->fetchColumn(0)  );
>         
>         $expected = 1;
>         $section = 'Ukraine';
>         $statement = $this->q->prepare();
>         $statement->execute();
>         
>         $this->assertEqual( $expected, (int) $statement->fetchColumn(0)  );
>         
>         /* $this->dump( $q->getQuery() ); */
>         /* $this->dump($this->e); */
>     }
>     
>     function testingBindInteger()
>     {
>         $expected = 7;
>         
>         $num = 0;
>         $q = $this->q;
>         $e = $this->e;
>         
>         $q->select( 'COUNT(*)' )
>           ->from( 'query_test' )
>           ->where( $e->gt( 'employees', $q->bindParam( $num ) ) );
>         
>         $statement = $q->prepare();
>         $statement->execute();
>         
>         $this->assertEqual( $expected, (int) $statement->fetchColumn(0)  );
>         
>         $expected = 3;
>         
>         $num = 100;
>         $statement = $q->prepare();
>         $statement->execute();
>         $this->assertEqual( $expected, (int) $statement->fetchColumn(0)  );
>     }
> ...
> }}}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira