Firebird/Interbase PDO Schema

For those of you who are willing to test/play with creepy Firebird PDO support scheme for Yii.

Scheme tested on Firebird 2.1.3 for Windows, using php 5.2.11, Yii 1.0.9.

All the stuff connected with named parameters binding in data changing queries (insert/update) is broken due to the Firebird PDO known bug. Nevertheless data reading features seems to work properly (just as far as I tested it) including AR.

Installation:

1. Unpack yiifb.0.01.zip into %YII%/framework/db/schema/

2. Register schema classes in %YII%/framework/YiiBase.php

After




'CMssqlTableSchema' => '/db/schema/mssql/CMssqlTableSchema.php',



add




'CFirebirdColumnSchema' => '/db/schema/firebird/CFirebirdColumnSchema.php',

'CFirebirdCommandBuilder' => '/db/schema/firebird/CFirebirdCommandBuilder.php',

'CFirebirdPdoAdapter' => '/db/schema/firebird/CFirebirdPdoAdapter.php',

'CFirebirdSchema' => '/db/schema/firebird/CFirebirdSchema.php',

'CFirebirdTableSchema' => '/db/schema/firebird/CFirebirdTableSchema.php',



3. Add the following lines into %YII%/framework/db/CDbConnection.php

After




$pdoClass='CMssqlPdoAdapter';



add




else if($driver==='firebird')

    $pdoClass='CFirebirdPdoAdapter';



And after




return $this->_schema=new COciSchema($this);



add




case 'firebird':  // Firebird/Interbase driver

    return $this->_schema=new CFirebirdSchema($this);



4. DSN in your main.php should look somewhat similar to




'connectionString'=>'firebird:dbname=localhost:C:\Program Files\NetSchool\DB\MAIN30.GDB',



Good luck.

Thanks for doing this. I use firebird exclusively with Delphi and have been tinkering with Yii for a while now. Hoping that Yii 1.1 works well with Firebird :)

-L

Just to make things clear: that’s unlikely for Yii to support that DB properly unless people, who maintain Firebird PDO php extension, will get down to business. That’s also true to any other application/framework using Firebird PDO.

Tiny update addressing sql aliases compatibility issue.

Hi! thanks for Firebrd PDO shema, but i cant run this. The error i get:




Fatal error: Call to a member function setAttribute() on a non-object in B:\home\project\yii-1.1.0.r1700\framework\db\CDbConnection.php on line 310



First check your ‘connectionString’, try something like ‘firebird:dbname=C:\Program Files\NetSchool\DB\MAIN30.GDB’ if string format from the first post won’t do.

Hi!

I can’t search the next

And after connect to my database i receive error

Hi,

Obviously something has changed in Yii since 28 November 2009.

It seems that now it is the only option is to hack it yourself.