function drupal_get_schema

drupal_get_schema($table = NULL, $rebuild = FALSE)

Gets the schema definition of a table, or the whole database schema.

The returned schema will include any modifications made by any module that implements hook_schema_alter(). To get the schema without modifications, use drupal_get_schema_unprocessed().

Parameters

$table: The name of the table. If not given, the schema of all tables is returned.

$rebuild: If true, the schema will be rebuilt instead of retrieved from the cache.

Related topics

File

includes/bootstrap.inc, line 3239
Functions that need to be loaded on every Drupal request.

Code

function drupal_get_schema($table = NULL, $rebuild = FALSE) {
  static $schema;

  if ($rebuild || !isset($table)) {
    $schema = drupal_get_complete_schema($rebuild);
  }
  elseif (!isset($schema)) {
    $schema = new SchemaCache();
  }

  if (!isset($table)) {
    return $schema;
  }
  if (isset($schema[$table])) {
    return $schema[$table];
  }
  else {
    return FALSE;
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!bootstrap.inc/function/drupal_get_schema/7.x