Tips on Writing Portable SQL for PHP. If you are writing an application that is used in multiple environments and operating systems, you need to plan to support multiple databases. This article is based on my experiences with multiple database systems, stretching from 4th Dimension in my Mac days, to the databases I currently use, which are: Oracle, FoxPro, Access, MS SQL Server and MySQL. Although most of the advice here applies to using SQL with Perl, Python and other programming languages, I will focus on PHP and how the ADOdb database abstraction library offers some solutions.
Most database vendors practice product lock-in. The best or fastest way to do things is often implemented using proprietary extensions to SQL. This makes it extremely hard to write portable SQL code that performs well under all conditions. When the first ANSI committee got together in 1984 to standardize SQL, the database vendors had such different implementations that they could only agree on the core functionality of SQL. Many important application specific requirements were not standardized, and after so many years since the ANSI effort began, it looks as if much useful database functionality will never be standardized. Even though ANSI-92 SQL has codified much more, we still have to implement portability at the application level. [PHP Everywhere]