nn- wrote:Cleaner I might agree with, maybe sql generation and execution could be split so that php dbal can handle sql differences and hand off built statements to pdo for execution. But I doubt there is going to be a noticeable effect in the big picture.
I thought about this a little more and have come up with a concept.
Query abstractionQuery abstraction means providing DB specific queries. phpBB does this a bit for DBMS server info. And it kind-of does it by doing conditional queries depending on the used DBMS (those ugly switch case statements). It's also needed for DDL since the syntax is quite DBMS specific.
By introducing a proper query abstraction layer the query/syntax abstraction is separated from the actual DB access abstraction. This means you have two sets of drivers. You have DBAL drivers and query drivers. The DBAL driver handles access to the DB, so function calls to PDO, mysqli, etc. would go in there. Of course each of these being a separate driver. The second set of drivers are the query drivers. They allow you to build query for DDL, DBMS info and taking care of DBMS specific quirks. The DBAL driver specifies which query driver it wants to use. So the dbal_mysqli and dbal_pdo_mysql drivers could both use the dbal_query_mysql query driver.
Here's my miserable attempt of drawing it.
This would allow a better separation and reuse of DBMS-specific SQL. Do note that the query abstraction is to be pretty rudimentary. Just a mix of code from the current DBAL driver and db_tools in a separate class. And the db-specific ACP backup code could go in there too.
Of course all of this is all inside the DBAL, no outside code has to change for it to work.