You are here

function drupal_get_schema in Schema 5

Get the schema definition of a table, or the whole database schema. Copied from D6.

Parameters

$name: 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.

8 calls to drupal_get_schema()
schema_describe in ./schema.module
schema_inspect in ./schema.module
schema_mysql_inspect in engines/schema_mysql.inc
schema_pgsql_inspect in engines/schema_pgsql.inc
schema_report in ./schema.module

... See full list

File

./schema_util.inc, line 16

Code

function drupal_get_schema($name = NULL, $rebuild = FALSE) {
  static $schema = array();
  if (empty($schema) || $rebuild) {
    $schema = array();

    // Load the .install files to get hook_schema.
    module_load_all_includes('install');

    // Invoke hook_schema for all modules.
    foreach (module_implements('schema') as $module) {
      $current = module_invoke($module, 'schema');
      _drupal_initialize_schema($module, $current);
      $schema = array_merge($schema, $current);
    }
  }
  if (!isset($name)) {
    return $schema;
  }
  elseif (isset($schema[$name])) {
    return $schema[$name];
  }
  else {
    return FALSE;
  }
}