Blob

Last updated on
21 July 2018

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

The binary large object data (blob) type is used to store binary data (for example, Drupal’s cache table to store the cached data). Binary data may include music, images, or video.

Two sizes are available, normal and big.

Sample Code :
$field['fieldname'] = array(
  'type' => 'blob', 
  'size' => 'normal', // normal / big
  'not null' => FALSE, 
  'description' => t('field fieldname of tablename.'),
);

MySQL mappings in the schema.inc file :

      'blob:big'        => 'LONGBLOB',
      'blob:normal'     => 'BLOB',

A BLOB column comes with a maximum length of 65,535 (2^16 − 1) bytes or 65KB.

A LONGBLOB column comes with a maximum length of 4,294,967,295 (2^32 − 1) bytes or 4GB.

These are variable length data types. They occupy only the amount of data actually stored plus 2 to 4 bytes extra.
 

Help improve this page

Page status: No known problems

You can: