PDO Driver for SQL Server CTP

The SQL Server team had a great announcement yesterday at DrupalCon in San Francisco. They announced the availability of a PDO Driver for SQL Server to give fantastic access to SQL Server from PHP. PDO is the PHP Data Objects extension that has become the standard way to do data access in PHP 5.0 or later projects that want to have some level of database agnosticism. Drupal, for example, uses the PDO driver for all of it’s database access.

The rough architecture for the 1.1 and 2.0 SQL Server drivers is outline below.

image 

In short, they centralized a lot of the core functionality into a common layer and have fairly thin wrappers over the top of that for the native and PDO drivers. This means that both will perform equally.

The great news for anyone who has written their applications with PDO rather than native drivers for a given database is that they should be able to plug in the new SQL Server PDO driver and start testing.

To be absolutely clear, however, PDO is not a full database abstraction. It doesn’t rewrite SQL statements of abstract away concepts such as MySQL Limits and the like. If you are using database specific features like that, you will have to rewrite those bits in your project.

See the official announcement on the SQL Server team’s blog at Interoperability @ Microsoft : SQL Server Driver for PHP 2.0 CTP adds PHP’s PDO style data access for SQL Server