12.07.2015 Views

Solution Guide for Migrating Oracle on UNIX to SQL Server - Willy .Net

Solution Guide for Migrating Oracle on UNIX to SQL Server - Willy .Net

Solution Guide for Migrating Oracle on UNIX to SQL Server - Willy .Net

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

244 Developing: Applicati<strong>on</strong>s — <str<strong>on</strong>g>Migrating</str<strong>on</strong>g> PHPOperati<strong>on</strong> Task ORA functi<strong>on</strong> MS<strong>SQL</strong> functi<strong>on</strong>ora_commit()Rollbackora_rollback() -Error Handling Error checking ora_error()-ora_errorcode()OthersName of result ora_columnname() mssql_field_name()columnSize of result ora_columnsize() mssql_field_length()columnDatatype of result ora_columntype() mssql_field_type()columnNumber of rowseffectedora_numrows() mssqp_num_rows()Number of columns ora_numcols() mssql_num_fields()returnedCase 2: Interoperating a PHP Applicati<strong>on</strong> Using OCI8Functi<strong>on</strong>s To interoperate using OCI8, follow these comm<strong>on</strong> steps:As with Case 1 "Interoperating a PHP Applicati<strong>on</strong> Using ORA Functi<strong>on</strong>s", the best alternative<str<strong>on</strong>g>for</str<strong>on</strong>g> OCI8 functi<strong>on</strong>s is <strong>to</strong> replace them with MS<strong>SQL</strong> calls. Most of the steps are the samebetween this procedure and the p rocedure in the "Case 1: Interoperating a PHP Applicati<strong>on</strong>Using ORA F uncti<strong>on</strong>s" secti<strong>on</strong> of this scenario. As a result, these steps are not described indetail here.1. Install the FreeTDS <strong>SQL</strong> <strong>Server</strong> libraries.2. Compile PHP <strong>to</strong> use MS<strong>SQL</strong>APIs.3. Enable MS<strong>SQL</strong> functi<strong>on</strong>s within php.ini.4. Verify the installati<strong>on</strong> using phpinfo().5 . Change all embedded <strong>SQL</strong> statements <strong>to</strong> T-<strong>SQL</strong>.Refer <strong>to</strong> Chapter 11, "Developin g: Applicati<strong>on</strong>s — <str<strong>on</strong>g>Oracle</str<strong>on</strong>g> <strong>SQL</strong> and PL/<strong>SQL</strong>," <str<strong>on</strong>g>for</str<strong>on</strong>g> adetailed discussi<strong>on</strong> <strong>on</strong> modifying <str<strong>on</strong>g>Oracle</str<strong>on</strong>g> <strong>SQL</strong> <strong>to</strong> be <strong>SQL</strong> <strong>Server</strong>-compliant.6. Modify applicati<strong>on</strong> code <strong>to</strong> reflect the new drivers.The following sample source code is used <strong>to</strong> illustrate the changes required in PHPcode when replacing OCI8 functi<strong>on</strong>s with MS<strong>SQL</strong> functi<strong>on</strong>s.The following example is the original OCI8-based PHP code:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!