framework/db/ar/CActiveRecord.php
public function findAllBySql($sql,$params=array())
	{
		Yii::trace(get_class($this).'.findAllBySql()','system.db.ar.CActiveRecord');
		$this->beforeFind();
		if(($criteria=$this->getDbCriteria(false))!==null && !empty($criteria->with))
		{
			$this->resetScope(false);
			$finder=$this->getActiveFinder($criteria->with);
			return $finder->findAllBySql($sql,$params);
		}
		else
		{
			$command=$this->getCommandBuilder()->createSqlCommand($sql,$params);
			return $this->populateRecords($command->queryAll());
		}
	}
public function findAllBySql($sql,$params=array())
	{
		Yii::trace(get_class($this).'.findAllBySql()','system.db.ar.CActiveRecord');
		$this->beforeFind();
		if(($criteria=$this->getDbCriteria(false))!==null && !empty($criteria->with))
		{
			$this->resetScope(false);
			$finder=$this->getActiveFinder($criteria->with);
			return $finder->findAllBySql($sql,$params);
		}
		else
		{
			$command=$this->getCommandBuilder()->createSqlCommand($sql,$params);
			return $this->populateRecords($command->queryAll());
		}
	}
public function findAllBySql ( $ sql , $ params = array ( ) ) { Yii :: trace ( get_class ( $ this ) . '.findAllBySql()' , 'system.db.ar.CActiveRecord' ) ; $ this -> beforeFind ( ) ; if ( ( $ criteria = $ this -> getDbCriteria ( false ) ) !== null && ! empty ( $ criteria -> with ) ) { $ this -> resetScope ( false ) ; $ finder = $ this -> getActiveFinder ( $ criteria -> with ) ; return $ finder -> findAllBySql ( $ sql , $ params ) ; } else { $ command = $ this -> getCommandBuilder ( ) -> createSqlCommand ( $ sql , $ params ) ; return $ this -> populateRecords ( $ command -> queryAll ( ) ) ; } }
Finds all active records using the specified SQL statement.
@param string $sql the SQL statement
@param array $params parameters to be bound to the SQL statement
@return static[] the records found. An empty array is returned if none is found.
Finds all active records using the specified SQL statement .