What is lacking in Zend_DB to make it a full abstraction layer

There are mainly 2 PHP abstraction layers out there:

I used both for long time within P4A and the conclusion is that none of them is good enough, because of feature lacks, bugs, communication difficulties with the team. I have to say that MDB2 code is much clearer.

But there’s something interesting coming out from the enterprise world: Zend_DB, really well written and planned, feature rich and with a good team behind, but as the team says “it’s not a full abstraction/portability layer” so why not fill the hole?

What’s missing:

  • sequence emulation, creating a table on DBs where sequences are not implemented. PEAR::DB already did it since years. This approach is not the best if you look for performance but it’s perfect for portability.
  • metadata retrieving from a query instead than a table. We can read columns and metadata from a table but what about a query such as “SELECT * FROM table JOIN other_table”? We need to know which fields are returned, the data type and the table name.
  • metadata mapping between different db engines, building an abstraction layer between different datatypes on different db engines, something mapping MySQL tinyint(1) to PostgreSQL::boolean and so on. MDB2 and ADODB already do that thus adding this feature won’t be too painful.

I’m also thinking about the redundancy of db adapters in PHP5 but that will be the subject of another post…

One thought on “What is lacking in Zend_DB to make it a full abstraction layer

Leave a Reply

Your email address will not be published. Required fields are marked *