PDO Port for WordPress

A couple of months ago I took up the challenge of trying to port WordPress to sqlite…

There are a number of ways to skin this cat. I chose to go down the abstraction route for the following reasons:

  • i don’t need to maintain a separate fork for each release of wordpress
  • there is a greater likelihood of compatibility with plugins;
  • it seemed neater!

I originally was going to write or reuse a sql parser and do some on the fly sql restructuring but in the end found this was too much like hard work. So I’ve ended up with a SQL rewriting solution.

It works. I need to tweak it for new plugins/core releases but the structure I have used makes this very easy/quick to do, once the underlying incompatibility has been identified.

Some restrictions have been imposed by this port. Primarily amongst these is that the port uses PDO and so is restricted to PHP5 +. On this basis I took the step of writing PHP5 compatible classes for the port. In short the restrictions are:

  • PHP5+ only
  • requires PDO and SQLITE (see 1&1 for a host that supports this)
  • does not (currently) support upgrades to the core (the ALTER syntax is dummied out)

The cascading class structure that I have used will make it very straightforward for others to create ‘drivers’ for other database back-ends that are supported by PDO. Equally, developers could take the drivers that I have written and marry them instead to another database abstraction layer, like ADODB or MDB2. Personally, I’m a fan of PDO!

I have been using the port for a week or so now, with no particular issues.

I plan to release a code drop here in a few days and would be grateful for you all to test it and report back. I also plan to create a plugin to allow for database backups.

In the meantime, if any of you would like me to test a particular plugin, don’t hesitate to post a comment.

Justin

Leave a comment

Your comment