Changeset 5087

Show
Ignore:
Timestamp:
10/15/08 19:59:45 (9 months ago)
Author:
jwage
Message:

[1.0, 1.1] fixes #1558 - issue with empty whereIn params

Location:
branches
Files:
2 added
4 modified

Legend:

Unmodified
Added
Removed
  • branches/1.0/lib/Doctrine/Query/Abstract.php

    r5077 r5087  
    12861286    public function andWhereIn($expr, $params = array(), $not = false) 
    12871287    { 
     1288        // if there's no params, return (else we'll get a WHERE IN (), invalid SQL) 
     1289        if ( ! count($params)) { 
     1290            return $this; 
     1291        } 
     1292 
    12881293        if ($this->_hasDqlQueryPart('where')) { 
    12891294            $this->_addDqlQueryPart('where', 'AND', true); 
     
    13041309    public function orWhereIn($expr, $params = array(), $not = false) 
    13051310    { 
     1311        // if there's no params, return (else we'll get a WHERE IN (), invalid SQL) 
     1312        if ( ! count($params)) { 
     1313            return $this; 
     1314        } 
     1315 
    13061316        if ($this->_hasDqlQueryPart('where')) { 
    13071317            $this->_addDqlQueryPart('where', 'OR', true); 
  • branches/1.0/tests/run.php

    r5086 r5087  
    156156$tickets->addTestCase(new Doctrine_Ticket_1543_TestCase()); 
    157157$tickets->addTestCase(new Doctrine_Ticket_1545_TestCase()); 
     158$tickets->addTestCase(new Doctrine_Ticket_1558_TestCase()); 
    158159$test->addTestCase($tickets); 
    159160 
  • branches/1.1/lib/Doctrine/Query/Abstract.php

    r5074 r5087  
    13851385    public function andWhereIn($expr, $params = array(), $not = false) 
    13861386    { 
     1387        // if there's no params, return (else we'll get a WHERE IN (), invalid SQL) 
     1388        if ( ! count($params)) { 
     1389            return $this; 
     1390        } 
     1391 
    13871392        if ($this->_hasDqlQueryPart('where')) { 
    13881393            $this->_addDqlQueryPart('where', 'AND', true); 
     
    14031408    public function orWhereIn($expr, $params = array(), $not = false) 
    14041409    { 
     1410        // if there's no params, return (else we'll get a WHERE IN (), invalid SQL) 
     1411        if ( ! count($params)) { 
     1412            return $this; 
     1413        } 
     1414 
    14051415        if ($this->_hasDqlQueryPart('where')) { 
    14061416            $this->_addDqlQueryPart('where', 'OR', true); 
  • branches/1.1/tests/run.php

    r5086 r5087  
    169169$tickets->addTestCase(new Doctrine_Ticket_1543_TestCase()); 
    170170$tickets->addTestCase(new Doctrine_Ticket_1545_TestCase()); 
     171$tickets->addTestCase(new Doctrine_Ticket_1558_TestCase()); 
    171172$test->addTestCase($tickets); 
    172173