DRUPAL Basics 7 (The database)

We have taken a brisk walk through a typical Drupal request, and we have learned a
little about modules and libraries. However, what about the database?
Unlike many architectures, for Drupal the database doesn’t stand front and center.
The database layer is not a module, nor do modules need to declare a specific
relationship with the database. In fact, many Drupal modules do not ever interact
directly with the database.

Instead of treating the database as a central architectural component, Drupal merely
provides an API for working with the database. In Drupal, the database is just a
place to store data. Need custom tables? Drupal provides a system for declaring
them. Need to get data out of the database, or insert or update new data? Drupal
provides functions and an OO library for doing so. However, if you don’t need such
features for your code, you needn’t work with the database at all. In fact, in the next
chapter we will write our first module without writing a single SQL query.

While Drupal may not be database centric, it most certainly requires a database.
During initialization, Drupal will connect to a database and retrieve certain
configuration data. Later, as many of the core modules load, they too, contact the
database to retrieve or update information. For most Drupal modules, the database
is the location for data storage.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s