Binding Parameters and Active Record

From other threads here I read that Yii Active Record uses Parameter Binding and Prepared Statements whereever possible. Is there some documentation on that (other than the sourcecode :) ).

If I wanted to do something like:

$command->bindParam(":xmlblob",$xmlblob,PDO::PARAM_LOB);

Is that possible with Active Record?

I guess AR per default uses something like

$command->bindParam(":xmlblob",$xmlblob,PDO::PARAM_STR);

But that doesnt work with different Databases and I don’t want to include another abstraction for different databases in the code.

Would be nice if you could help me to understand what is possible and what not with AR

maybe this chapter can help you

http://www.yiiframework.com/doc/guide/1.1/en/database.dao

I probably did not express myself very clear.

I have trouble writing database independend code. I used Yii DAO and it seems to work, but I would rather use Active Record in that part of code. Another problem I ran into: getting the Primary Key with AR is much more easy and already implemented in a database independend way. I didn’t see a way to use Yii DAO and get the id of the last record, without doing something like

case ‘mysql’:

case ‘postgres’:

//use sequence

Not 100% sure, but a quick look shows, that CDbCommandBuilder::bindValue() (which is used by AR) uses CDbConnection::getPdoType() to find the correct PDO type from a PHP type. So you’re probably out of luck to set your custom type for AR.

Ok, thank you. I guess I will have to find a way around it.