PDO (SQLite) For WordPress

This ‘plugin’ enables WP to use databases supported by PHP’s PDO abstraction layer. Currently, mysql and sqlite drivers are provided.

Author:Justin Adie (profile at wordpress.org)
WordPress version required:2.3.0
WordPress version tested:2.9.2
Plugin version:2.7.0
Added to WordPress repository:24-06-2008
Last updated:14-01-2010
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:100
Rated by:2
Plugin URI:http://rathercurious.net
Total downloads:28 946
plugin download
Click to start download

WordPress has for a long time, and for good reasons, been locked into using mysql as its database storage engine. There is a good discussion of 'why' in the codex

But this design choice has ramifications; not least because mysql's implementation of sql is not standard. Even with the use of the EZSQL abstraction layer bundled with WordPress, this makes plugging in other databases very difficult.

PDO For WordPress is a step towards eliminating this difficulty. Think about this 'plugin' in four steps:

  1. the basic layer takes all queries and separates out the variables from the language. It replaces each variable with a placeholder as well as stripping mysql specific 'nasties' like the slash-escaping and backticks.
  2. then a language specific driver steps in and rewrites the query to use its own native constructs or (in the case of SQLite) pushes the query into some special user-defined functions
  3. the basic layer then puts it all back together and runs the query, finally ...
  4. returning the whole thing to the EZSQL abstraction layer so that WordPress doesn't know that anything has gone awry

See below/other notes for details of known limitations