function chado_is_local

2.x tripal_core.chado_schema.api.inc chado_is_local()
3.x tripal_chado.schema.api.inc chado_is_local()

Check that the Chado schema exists within the local database

Return value

TRUE/FALSE depending upon whether it exists

Related topics

7 calls to chado_is_local()
chado_get_version in tripal_core/api/tripal_core.chado_schema.api.inc
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/tripal_core.chado_schema.api.inc
Check whether chado is installed (either in the same or a different database)
tripal_core_chado_schema_exists in tripal_core/api/tripal_core.DEPRECATED.api.inc
tripal_core_is_chado_local in tripal_core/api/tripal_core.DEPRECATED.api.inc
tripal_core_set_globals in tripal_core/tripal_core.module
This function is used to set the global Chado variables

... See full list

2 string references to 'chado_is_local'

File

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

Code

function chado_is_local() {

  // This is postgresql-specific code to check the existence of the chado schema
  // @coder-ignore: acting on pg_catalog schema rather then drupal schema therefore, table prefixing does not apply
  $sql = "
    SELECT nspname
    FROM pg_namespace
    WHERE
      has_schema_privilege(nspname, 'USAGE') AND
      nspname = :chado
  ";
  $results = db_query($sql, array(':chado' => tripal_get_schema_name('chado')));
  $name = $results->fetchObject();
  if ($name) {
    variable_set('chado_schema_exists', FALSE);
    return TRUE;
  }
  else {
    variable_set('chado_schema_exists', TRUE);
    return FALSE;
  }
}