Typecast issue in Oracle with ActiveRecord

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 CDbExp​ression)


			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?

Is your change about removing the typcasting for integer-typed values? Why would removing it solve the problem?

Yes, you right.I do a test like this, same as typecasting function in COciColumSchema  :



echo (integer) 3209051402067702;


The result of the test above is -2132615434, it's not return 3209051402067702. So It try to find the primary key with the value no record will returned.

I found that integer value which has length more than 10 character not return same like it's real value.