I have problem with my application which running Yii with Oracle Express. One of my table has Primary Key which has type 'Number' and length 16 characters.
If I use Active Record with findByPk on that column, the Active Record can't find the record that I want. I'm sure that record with PK in findByPk method was exist in my table. I found the problem is typecast on CDbColumSchema which I think it has change the PK before query to DB. So I override the typecast function in to COciColumSchema and ActiveRecord can return the record that I want.
Here is the function that I override in COciColumnSchema
public function typecast($value) { if(gettype($value)===$this->type || $value instanceof CDbExpression) return $value; if($value===''|| $value===null||empty($value)) return ''; switch($this->type) { case 'boolean': return (boolean)$value; case 'double': return (double)$value; case 'string': return (string)$value; default: return $value; } }
Qiang, is this a bug? Should I create a ticket for this?