function chado_get_schema

2.x tripal_core.chado_schema.api.inc chado_get_schema($table)
3.x tripal_chado.schema.api.inc chado_get_schema($table)

Retrieves the chado tables Schema API array.

@returns A Drupal Schema API array defining the table.

Parameters

$table: The name of the table to retrieve. The function will use the appopriate Tripal chado schema API hooks (e.g. v1.11 or v1.2).

Related topics

32 calls to chado_get_schema()
chado_add_node_form_relationships in tripal_core/api/tripal_core.chado_nodes.relationships.api.inc
Provides a form for adding to BASE_relationship and relationship tables
chado_delete_property in tripal_core/api/tripal_core.chado_general.api.inc
Deletes a property for a given base table record using the property name
chado_delete_record in tripal_core/api/tripal_core.chado_query.api.inc
Provides a generic function for deleting a record(s) from any chado table
chado_expand_var in tripal_core/api/tripal_core.chado_variables.api.inc
Retrieves fields, or tables that were excluded by default from a variable.
chado_generate_var in tripal_core/api/tripal_core.chado_variables.api.inc
Generates an object containing the full details of a record(s) in Chado.

... See full list

1 string reference to 'chado_get_schema'

File

tripal_core/api/tripal_core.chado_schema.api.inc, line 468

Code

function chado_get_schema($table) {

  // first get the chado version that is installed
  $v = $GLOBALS["chado_version"];

  // get the table array from the proper chado schema
  $v = preg_replace("/\./", "_", $v); // reformat version for hook name

  // Call the module_invoke_all.
  $hook_name = "chado_schema_v" . $v . "_" . $table;
  $table_arr = module_invoke_all($hook_name);

  // If the module_invoke_all returned nothing then let's make sure there isn't
  // An API call we can call directly.  The only time this occurs is
  // during an upgrade of a major Drupal version and tripal_core is disabled.
  if ((!$table_arr or !is_array($table_arr)) and 
    function_exists('tripal_core_' . $hook_name)) {
    $api_hook = "tripal_core_" . $hook_name;
    $table_arr = $api_hook();
  }

  // if the table_arr is empty then maybe this is a custom table
  if (!is_array($table_arr) or count($table_arr) == 0) {
    $table_arr = chado_get_custom_table_schema($table);
  }

  return $table_arr;
}