(Fixes issue 2325)

This commit is contained in:
qiang.xue
2011-04-13 01:07:50 +00:00
parent 2c44a220c9
commit 3d0fb9c6ff
2 changed files with 6 additions and 1 deletions

View File

@@ -572,10 +572,12 @@ class CDbCommand extends CComponent
* Columns can contain table prefixes (e.g. "tbl_user.id") and/or column aliases (e.g. "tbl_user.id AS user_id").
* The method will automatically quote the column names unless a column contains some parenthesis
* (which means the column contains a DB expression).
* @param string $option additional option that should be appended to the 'SELECT' keyword. For example,
* in MySQL, the option 'SQL_CALC_FOUND_ROWS' can be used. This parameter is supported since version 1.1.8.
* @return CDbCommand the command object itself
* @since 1.1.6
*/
public function select($columns='*')
public function select($columns='*', $option='')
{
if(is_string($columns) && strpos($columns,'(')!==false)
$this->_query['select']=$columns;
@@ -598,6 +600,8 @@ class CDbCommand extends CComponent
}
$this->_query['select']=implode(', ',$columns);
}
if($option!='')
$this->_query['select']=$option.' '.$this->_query['select'];
return $this;
}