README.md

oci8Pdo

A Yii Extension to simulate the Oracle PDO using the PHP OCI8 functions. The PDO driver simulation files can be used without Yii as well.

The goal of this PDO class is to simulate 99% of the PDO functions that you use in an application.
If you find any problems, I would love the feedback. Please open an Issue. Creating UnitTests is on my TODO list.

2. Install for Yii Framework

<?php// application components'components'=>array( // MySQL database config'db'=>array('connectionString'=>'mysql:host=myDataBaseHost.com;dbname=myDataBase','username'=>'','password'=>'','charset'=>'utf8', ),'dbOracle'=>array('class'=>'ext.oci8Pdo.OciDbConnection',/* * Note: Normally you use the Easy Connect string, but your server has * to be correctly set-up for that. * * ** Easy Connect String ** * If you get the following error: `ORA-12154: TNS:could not resolve the connect identifier specified`, * go to /opt/oracle/instantclient/sqlnet.ora and change the following line: * NAMES.DIRECTORY_PATH= (TNSNAMES) * Change this to: * NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT) */// 'connectionString' => 'oci:dbname=//myOracleHost.com:1526/ccq',/* * ** Full Connection String ** * Use this method incase your Easy Connect gives you errors and you can't edit the sqlnet.ora file. * You can set the charset in this string as well, add `;charset=AL32UTF8;` at the end for UTF-8. */'connectionString'=>'oci:dbname=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=myOracleHost.com) (PORT=1526))(CONNECT_DATA=(SERVICE_NAME=myService.intern)));charset=AL32UTF8;','username'=>'','password'=>'',/* * enableProfiling and enableParamLogging are working like normal; Default is false. */'enableProfiling'=>true,'enableParamLogging'=>true, ), ),

Step 3: There is no step three. You're done!

3. Usage

To start, you need to understand that Oracle Databases have CASE-SENSITIVE columns. Most DataBase Administrators in the Oracle world use capital table names and capital column names. That means you have to do that as well in your application.

3.1 DOA and the Query Builder both work. As long as you use the right database component.

3.2 ActiveRecord works as well!

There are two important things to consider however:

Column names are case-sensitive, that means that the Models' attributes are as well!

The database schema for Oracle (COciSchema) can be quite heavy on performance. That means that if you want to use Oracle in combination of ActiveRecord, you HAVE to cache the schema, or else you will experience a lot of performance degradation. Check the following two links:

<?php$model=newIvrModel;//Note the attributes are fully capitalized$model->PC_TO=1111;$model->PC_FROM=1113;$model->PRODUCTTYPE='Internet';$model->TTS='';$model->ANNOUNCEMENT='7501.wav';$model->TYPE=0;$model->TICKET=5555;$model->save();