DBTNG

HowTo: Convert a module to DBTNG

DBTNG is the new database abstraction layer of Drupal 7. It uses several OOP principles and provides far more features than Drupal 6 did.

Most queries need to be slighty changed to work with DBTNG, this blog post will explain some of the most common conversions.

Simple SELECT queries

Most queries don't need much work. Usually, two things need to be done:

Filter DB Extender patch

I've written quite a few patches for Drupal in the last few months, but most of them were either bugfixes or ideas/patches/tasks of others I've taken further.

Recently, I proposed the first patch, that was my own idea : http://drupal.org/node/450666.

DBTNG does have the nice concept of Extenders, which are essentially a standardized Decorator pattern. You can use them to provider additional functionality to the SelectQuery class, which can build a SELECT Query with a OOP-QueryBuilder.

Subscribe to RSS - DBTNG