I’m trying to make my project to support Oracle DB, but I found that it is not as simple as I think.
As in Oracle, if we quote the column or table name , it means in case sensitive mode when execute SQL. In my project, table name an column name are all lowercase, and in AR classes, they are also lowercase. It’s going well with MySQL…
I fond AR class will quote the table and column in select, like below codes in CDbCommandBuilder:
foreach($table->getColumnNames() as $name)
$select[]=$prefix.$this->_schema->quoteColumnName($name);
But in condition expression, I have to do it myself, Yii can not automaticly quote the column and no simple method to do it. So I have to change my code like this
...
$criteria->condition = Yii::app()->db->quoteColumnName('type') .' = :type and ' . Yii::app()->db->quoteColumnName('name') . '=:name';
...
It seems so complicated, and what I can do is just define a short named function like q(). Unfortunately, there are nearly one hundred AR classes in my project , anyone who give me guidance ? Thanks.