This problem is not in PDO driver, but in oracle itself, and Yii assumes that aliases for tables and columns will be answered as they are sent:
If we sent a query like
[sql] select abc as def from ghi[/sql]
we will get a table with a column in upper case always:
[font="Lucida Console"] DEF
value1
value2[/font]
If we create a table with quoted identifiers, then they will be treated case sensitive, but in all queries we will need to quote identifiers:
[sql]
create table "User" … colunm "myName" …
select "myName" from "User" OK
select myName from User Error
[/sql]
Yii (1.0.7) make aliases for columns and tables in lowercase in system.db.ar.CActiveFinder constructor.
To solve these issues, I just changed lines 326, 373 and 375 as follows:
public function __construct($finder,$relation,$parent=null,$id=0)
{
$this->_finder=$finder;
$this->id=$id;
if($parent!==null)
{
$this->relation=$relation;
$this->_parent=$parent;
$this->_builder=$parent->_builder;
326 $this->tableAlias=$relation->alias===null?'T'.$id:$relation->alias;
$this->model=CActiveRecord::model($relation->className);
$this->_table=$this->model->getTableSchema();
}
else // root element, the first parameter is the model.
{
$this->model=$relation;
$this->_builder=$relation->getCommandBuilder();
$this->_table=$relation->getTableSchema();
}
373 // set up column aliases, such as T1_C2
$table=$this->_table;
375 $prefix='T'.$id.'_C';
foreach($table->getColumnNames() as $key=>$name)
{
$alias=$prefix.$key;
$this->_columnAliases[$name]=$alias;
if($table->primaryKey===$name)
$this->_pkAlias=$alias;
else if(is_array($table->primaryKey) && in_array($name,$table->primaryKey))
$this->_pkAlias[$name]=$alias;
}
}
Aliases in uppercase will always work in oracle and probably in all other supported databases.
Changing PDO driver case will not work since table descriptions return columns names and table names in uppercase.
Can these changes be commited in Yii 1.0.8 ?
Thanks