As I wrote in my updated Cookbook article, Oracle table names are only case-sensitive, when passed inside quotation marks. Therefore, it seems that somewhere in Yii code underlying below ActiveRecord there have to be a part which escapes table name with quotation mark, making above mentioned problems.
Can anyone approve this is true? And if so - is this really necessary? I must admit that it drives me a little bit crazy, that if porting application from another RDBMS to Oracle I have to manually update each model and nearly each file to change fields names to uppercase!
Thanks for your support. But I’m pretty sure that this problem lies in core code of Yii. For some reason, fields’ names (and tables’ names too) are quoted when sent to PDO/DB which has no impact on other RDBMS but causes huge problems in Oracle.
I started this thread to get answer from dev team is it necessary to quote name or maybe this "feature" could be removed?
Maybe this thread should be moved to Feature Request forum?
I don’t know about your Oracle problems but you do know that the keyField name is configurable? (like pretty much everything in yii, so i don’t understand your complaints)
I have the same problem with oracle names. I would like the database to accept lower-case just as upper-case table and column names…
It says here it could be configured somehow by configurating keyField ?? I’m very new to Yii and I dont know how and where to put such configuration… can someone please point me in a right direction ??
I can’t remember how I got to this topic, but just in case anyone else does, here’s how I fixed this. I created a new component “OciSchema” which replaces the “quoteSimple*Name” methods with functions that only replace reserved words. I also limited that reserved word list to table/column names in my database because I have tight control over that. You may want a broader list:
<?php
class OciSchema extends COciSchema {
private $reserved = array('ACCESS','SESSION','MODE','LEVEL','DESC','FROM','TO','YEAR');
public function quoteSimpleTableName($name) {
return in_array($name,$this->reserved) ? '"'.$name.'"' : $name;
}
public function quoteSimpleColumnName($name) {
return in_array($name,$this->reserved) ? '"'.$name.'"' : $name;
}
}
To implement, you simply need to include the following in your DB config (compenents -> db):
'driverMap' => array('oci'=>'OciSchema'),
This is a full or perfect solution but it fits our scenario and may fit your’s too.