ClassicPress PetitionsClassicPress Petitions
This is a read-only archive. Post or comment on the live version of this page on our forums.

Add PDO support

October 30, 2018 · 12:09 · stefanos82
Description

I personally want to have an SQLite as my default database, as I have a few friends' websites that have extremely low traffic. There's no need to have MySQL installed for such a small website that contains basic information.

No, SQLite can handle high volume of traffic as well and those who don't believe me, go check https://levels.io/remote-ok/

But that is not the point here.

We really need to have more alternatives to MySQL / MariaDB / Persona.

Thanks to PDO, we could have MS-Server, PostgreSQL, SQLite, Oracle...but we really need to support only the three most used: SQLite, MySQL, and PostgreSQL.

Voters
+7 more
Tags
Request: Add feature
Discussion
James Nylen

I am all for this, but it would have to be an opt-in, advanced feature at first. I bet almost every popular or non-trivial plugin would break in some way if we made a fundamental change to the DB layer.

Mike Schinkel

I know this is something a lot of people want, but I question if it would actually be workable long term or just a lot of good effort wasted?

I look at Drupal's support for multiple databases, but as far as I know few people use it with anything by MySQL (or compatible, e.g. MariaDB) because most (all?) Drupal modules are written to work with MySQL and not other databases.

And there are a lot more WordPress plugins than there are Drupal modules. So the intertia would always be pulling for MySQL-ish and against everything else.

#fwiw #jmtcw

Mark Kaplun

I also do not think that a DB engine compatibility is a pressing issue, but standardization always have benefits and the more you can nudge people into the direction of writing good and secure SQL the better.

PDO forces you to use properly prepared statements and have support for transactions. You can do both directly with the mysqli driver but this I guess might require almost the same amount of effort as moving to PDO.

Maybe what is needed as first step is to support proper prepared statements in WPDB, maybe as separate API, and than start to move isolated requests to a proper prepared statements model.

Ben Overmyer

I've long wanted to use PostgreSQL as the backing datastore for WordPress. This would make that a possibility.

I imagine it's possible to get this implemented as an optional interface that lives alongside the existing interface. If people choose a different backing datastore, then they should be technically savvy enough to realize that many plugins will break if they do, and they should make that choice themselves.

Peter Molnar

SQLite is ok with high traffic, but not with concurrent write locks, which is a basic problem with things like PHP-FPM.

As much as I'd love to see a DAL (database abstraction layer) in WordPress, this is a very hard topic.

Greg Schoppe

ezSQL (the library that WPDB is based on) offers drivers for MSSQL, SQLite, PostgreSQL and PDO. One of the original goals of the library was to abstract away from a single data store.

That said, WP abandoned multi-engine support a long time ago, because the only way to run even slightly performant DB queries is to make use of engine-specific optimizations. Trying to rewrite CP to use only the limited subset of SQL that is supported by all DB engines is gonna be pretty close to impossible.