Hey guys,
please tell me if I’m missing something.
Why are columns specified by a [color="#0000FF"]CDbCriteria::$select[/color] quoted if the query is build by [color="#0000FF"]CActiveFinder::getColumnSelect()[/color] but not if the query is build by [color="#0000FF"]CDbCommandBuilder::createFindCommand()[/color]? Both methods are used by [color="#0000FF"]CActiveRecord::query()[/color], the first one if [color="#0000FF"]CDbCriteria::$with[/color] was set the later if it’s just a single table being queried.
So following results in an MySQL error, as column "key" must be quoted:
User::model()->findByPk($pk, array(
'select'=>array('key'),
));
But as soon as I join any relation, it will get quoted and thus will return the result:
User::model()->findByPk($pk, array(
'select'=>array('key'),
'with'=>array('profile'),
));
Sure, you should not be using MySQL keywords as column names in the first place. Still this behavior doesn’t really make sense, does it?
Thank you for your feedback!
David