Community Documentation

drupal_get_schema

6 common.inc drupal_get_schema($table = NULL, $rebuild = FALSE)
7 bootstrap.inc drupal_get_schema($table = NULL, $rebuild = FALSE)
8 bootstrap.inc 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().

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

▾ 24 functions call drupal_get_schema()

DatabaseInsertDefaultsTestCase::testDefaultInsert in modules/simpletest/tests/database_test.test
Test that we can run a query that is "default values for everything".
DatabaseInsertDefaultsTestCase::testDefaultInsertWithFields in modules/simpletest/tests/database_test.test
Test that we can insert fields with values and defaults in the same query.
DatabaseSelectComplexTestCase2::setUp in modules/simpletest/tests/database_test.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
DatabaseTestCase::ensureSampleDataNull in modules/simpletest/tests/database_test.test
Set up tables for NULL handling.
DatabaseTestCase::setUp in modules/simpletest/tests/database_test.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
DrupalWebTestCase::resetAll in modules/simpletest/drupal_web_test_case.php
Reset all data structures after having enabled new modules.
DrupalWebTestCase::tearDown in modules/simpletest/drupal_web_test_case.php
Delete created files and temporary files directory, delete the tables created by setUp(), and reset the database prefix.
drupal_schema_fields_sql in includes/common.inc
Retrieves a list of fields from a table schema.
drupal_write_record in includes/common.inc
Saves (inserts or updates) a record to the database based upon the schema.
EntityFieldQuery::propertyQuery in includes/entity.inc
Queries entity tables in SQL for property conditions and sorts.
FieldSqlStorageTestCase::testFieldSqlStorageForeignKeys in modules/field/modules/field_sql_storage/field_sql_storage.test
Test foreign key support.
field_sql_storage_field_storage_create_field in modules/field/modules/field_sql_storage/field_sql_storage.module
Implements hook_field_storage_create_field().
field_sql_storage_field_storage_delete_field in modules/field/modules/field_sql_storage/field_sql_storage.module
Implements hook_field_storage_delete_field().
field_sql_storage_field_storage_update_field in modules/field/modules/field_sql_storage/field_sql_storage.module
Implements hook_field_storage_update_field().
hook_field_storage_create_field in modules/field/field.api.php
Act on creation of a new field.
hook_field_storage_delete_field in modules/field/field.api.php
Act on deletion of a field.
hook_field_storage_update_field in modules/field/field.api.php
Update the storage information for a field.
ImageFieldDisplayTestCase::testImageFieldSettings in modules/image/image.test
Tests for image field settings.
install_configure_form in includes/install.core.inc
Installation task; configure settings for the new site.
install_finished in includes/install.core.inc
Installation task; perform final steps and display a 'finished' page.
module_enable in includes/module.inc
Enables or installs a given list of modules.
profile_field_form_validate in modules/profile/profile.admin.inc
Validate profile_field_form submissions.
user_account_form_validate in modules/user/user.module
Form validation handler for user_account_form().
_node_query_node_access_alter in modules/node/node.module
Helper for node access functions.

File

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

Code

<?php
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;
  }
}
?>
Login or register to post comments