Drupal's Next Generation Database Layer

Everyone rejoice, as Dries has just committed the long standing Drupal Database Layer: The Next Generation patch. This was one of the items on my original Drupal 7 wishlist, and is one of the major steps that will make Drupal 7 a killer release. This patch does a number of awesome things, as outlined by Crell:

  • Allows fancy PDO database queries (foreach through a result-set, select columns of result-sets, etc)
  • Connect to multiple databases simultaneously
  • Database replication
  • Type-agnostic prepared statements, so we don't need to bother with %s or %d
  • Proper support for NULL values
  • Adds support for transactions, while allowing them to not die on non-transactional databases
  • Support for "INSERT ... ON DUPLICATE KEY UPDATE ..." on MySQL or whatever the database-specific equivalent on other databases
  • Support for multi-insert statements, on all databases, using the appropriate database-specific mechanism
  • "INSERT DELAYED" support on databases that support it or some equivalent, which should help performance on logging and similar "don't need it back immediately" queries
  • Fully-structured INSERT, UPDATE, and DELETE queries with a simple fluent API (chainable, like jQuery) syntax
  • A Fluent API query builder for SELECT statements that weighs in at only a few hundred lines (not counting comments)
  • .... And that's just naming a few of the benefits

Congratulations everyone! Crell, chx, bjaspan, catch, swentel, recidive, you guys rock!