PDO substitue?

I like what I see in Yii and I am thinking about replacing my core classes with Yii in my CMS however I have a couple questions:

. PDO substitute?

  +  There are host that does not support PDO so how would I substitute PDO with some other form of database support?

  + If I want to use DBI4PHP or EZ_SQL or ADODB as the database layer, how hard would that be to add that into Yii?

. Can I use Yii framework as the framework classes as the foundation of my CMS?

. If I rewrite my CMS to fit into Yii which would be the least amount of work to approach this project?


To substitute PDO, you need to write a new set of Yii PDO (CDbConnection etc.) based on DBI4PHP, EZ_SQL or ADODB. Once this is done, you can configure the 'db' app component to use your new CDbConnection class, and everything will work as if you have PDO.

Sure you can write a CMS using Yii, and that's one of the goals Yii is trying to achieve.

Without PDO that mean I can't use AR or any of the yiic to generate code.

Is that code?


That's correct. But you can create a PDO substitution, everything will still work.

So to do a PDO substitution so many files do I have to touch and how much work is involved.

Do I have to do the same each time you release a new version?

Is there a overload or something that I don't have to do a rewrite on each new release?


If I want to substitute PDO with DBI4PHP will I only need to write substitue code for these method or are there more?

CDbCommand  CDbCommand represents an SQL statement to execute against a database.

CDbConnection CDbConnection represents a connection to a database.

CDbDataReader CDbDataReader represents a forward-only stream of rows from a query result set.

CDbException CDbException represents an exception that is caused by some DB-related operations.

CDbTransaction CDbTransaction represents a DB transaction.


You will need to provide classes that are similar to CDbConnection, CDbCommand and CDbTransaction.

Right but how would I do in such a way that when the yiic generate it will use the substitute class rather than the the original PDO class?


yiic doesn't generate code about DB connection. Once you have your own DB connection class, you can simply use it by configuring the 'db' component with:






That's nice but how about CDbCommand and CDbTransaction.

How is Yii know to use mine instead of build in classes?


The command and transaction instances are created by the connection instance. So you have full control.