Changeset 3947

Show
Ignore:
Timestamp:
03/08/08 04:39:48 (16 months ago)
Author:
jwage
Message:

fixes #821

Location:
branches/0.10
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/0.10/lib/Doctrine/Query.php

    r3945 r3947  
    506506        // check for wildcards 
    507507        if (in_array('*', $fields)) { 
    508             //echo "<br />";Doctrine::dump($table->getColumnNames()); echo "<br />"; 
    509508            $fields = $table->getFieldNames(); 
    510509        } else { 
     
    537536 
    538537        $this->_neededTables[] = $tableAlias; 
    539         //Doctrine::dump(implode(', ', $sql)); 
    540         //echo "<br /><br />"; 
     538         
    541539        return implode(', ', $sql); 
    542540    } 
     
    18471845     * Copies a Doctrine_Query object. 
    18481846     * 
    1849      * @param Doctrine_Query   Doctrine query instance. 
    1850      *                         If ommited the instance itself will be used as source. 
    18511847     * @return Doctrine_Query  Copy of the Doctrine_Query instance. 
    18521848     */ 
     
    18601856 
    18611857        return $new; 
     1858    } 
     1859 
     1860    /** 
     1861     * __clone 
     1862     * 
     1863     * @return void 
     1864     */ 
     1865    public function __clone() 
     1866    { 
     1867        $this->_parsers = array(); 
    18621868    } 
    18631869 
  • branches/0.10/lib/Doctrine/Query/Abstract.php

    r3901 r3947  
    456456    public function removeSqlQueryPart($name) 
    457457    { 
    458         try { 
    459458        if ( ! isset($this->_sqlParts[$name])) { 
    460459            throw new Doctrine_Query_Exception('Unknown query part ' . $name); 
    461         }} 
    462         catch (Exception $e) {echo $e->getTraceAsString(); echo "<br /><br /><br />";} 
    463  
     460        } 
     461         
    464462        if ($name == 'limit' || $name == 'offset') { 
    465                 $this->_sqlParts[$name] = false; 
     463            $this->_sqlParts[$name] = false; 
    466464        } else { 
    467                 $this->_sqlParts[$name] = array(); 
    468         } 
     465            $this->_sqlParts[$name] = array(); 
     466        } 
     467         
    469468        return $this; 
    470469    } 
  • branches/0.10/tests/QueryTestCase.php

    r3884 r3947  
    112112        $this->assertTrue($q->count(), 1); 
    113113    } 
     114     
     115    public function testQueryCopyClone() 
     116    { 
     117        $query = new Doctrine_Query(); 
     118        $query->select('u.*')->from('User u'); 
     119        $sql = $query->getSql(); 
     120         
     121        $data = $query->execute(); 
     122        $query2 = $query->copy(); 
     123         
     124        $this->assertTrue($sql, $query2->getSql()); 
     125         
     126        $query2->limit(0); 
     127        $query2->offset(0); 
     128        $query2->select('COUNT(u.id) as nb'); 
     129         
     130        $this->assertTrue($query2->getSql(), 'SELECT COUNT(e.id) AS e__0 FROM entity e WHERE (e.type = 0)'); 
     131    } 
    114132} 
    115133class MyQuery extends Doctrine_Query