function tripal_get_schema_name

2.x tripal_get_schema_name($schema = 'chado')

Retrieve the name of the PostgreSQL schema housing Chado or Drupal.


$schema: Wehter you want the schema name for 'chado' or 'drupal'. Chado is the default.

Return value

The name of the PostgreSQL schema housing the $schema specified.

Related topics

15 calls to tripal_get_schema_name()
chado_add_node_form_relationships_name_to_id_callback in tripal_core/api/
Handles autocomplete for subject & object id
chado_column_exists in tripal_core/api/
Check that any given column in a Chado table exists.
chado_create_custom_table in tripal_core/api/
Add a new table to the Chado schema. This function is simply a wrapper for the db_create_table() function of Drupal, but ensures the table is created inside the Chado schema rather than the Drupal schema. If the table already exists then it will be…
chado_get_version in tripal_core/api/
Returns the version number of the currently installed Chado instance. It can return the real or effective version. Note, this function is executed in the hook_init() of the tripal_core module which then sets the…
chado_is_installed in tripal_core/api/
Check whether chado is installed (either in the same or a different database)

... See full list


tripal_core/api/, line 1807
Provides an API for querying of chado including inserting, updating, deleting and selecting from chado.


function tripal_get_schema_name($schema = 'chado') {

  // First we will set our default. This is what will be returned in most cases.
  if ($schema == 'chado') {
    $schema_name = 'chado';
  else {
    $schema_name = 'public';

  // There are cases where modules or admin might need to change the default
  // names for the schema. Thus we provide an alter hook here to allow
  // the names to be changed and ensure that schema names are never hardcoded
  // directly into queries.
  $context = array('schema' => $schema);
  drupal_alter('tripal_get_schema_name', $schema_name, $context);

  return $schema_name;