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
4 calls to chado_is_local()
- chado_is_installed in tripal_chado/
api/ tripal_chado.schema.api.inc - Check whether chado is installed (either in the same or a different database)
- tripal_chado_set_globals in tripal_chado/
tripal_chado.module - This function is used to set the global Chado variables
- tripal_core_chado_schema_exists in legacy/
tripal_core/ api/ tripal_core.DEPRECATED.inc - tripal_core_is_chado_local in legacy/
tripal_core/ api/ tripal_core.DEPRECATED.inc
2 string references to 'chado_is_local'
- tripal_core_chado_schema_exists in legacy/
tripal_core/ api/ tripal_core.DEPRECATED.inc - tripal_core_is_chado_local in legacy/
tripal_core/ api/ tripal_core.DEPRECATED.inc
File
- tripal_chado/
api/ tripal_chado.schema.api.inc, line 283 - Provides an application programming interface (API) for describing Chado tables.
Code
function chado_is_local() {
// If the is_local variable has been set then we've already checked if
// Chado is local and we don't need to repeat it again.
if (isset($GLOBALS["chado_is_local"])) {
return $GLOBALS["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' => chado_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;
}
}