function hook_chado_connection_alter

2.x tripal_core.chado_general.api.inc hook_chado_connection_alter(&$settings)

Alter Chado connection settings.

This hook is useful for multi-chado instances. Tripal core functions call the chado_set_active() function (e.g. chado_query) but there is no opportunity elsewhere to set the active database. This is useful in two cases: 1) Users are managed at the database level as in the case of SouthGreen Bioinformatics Platform tools (e.g. Banana Genone Hub). This allows custom modules to change the database connections on a per-user basis, and each user permissions is managed at the database level. Users are managed at the database level to provid the same access restrictions across various tools that use Chado (e,g, Artemis) 2) When there are simply two Chado instances housed in different Chado databases and the module needs to control which one is being used at any given time.

Parameters

$settings: An array containing

See also

chado_set_active()

Related topics

1 invocation of hook_chado_connection_alter()
chado_set_active in tripal_core/api/tripal_core.chado_general.api.inc
Set the Tripal Database

File

tripal_core/api/tripal_core.chado_general.api.inc, line 125
Provides an application programming interface (API) to manage data withing the Chado database.

Code

function hook_chado_connection_alter(&$settings) {
  // This example shows how we could make sure no table of the 'public' schema
  // would be allowed in the coming queries: to do so, the caller will call
  // "chado_set_active('chado_only');" and the hook will remove 'public' from
  // the search path.
  if ('chado_only' == $settings['dbname']) {
    $settings['new_active_db'] = 'chado';
    // We don't include 'public' in search path.
    $settings['new_search_path'] = 'chado';
  }
}