function chado_dbschema_exists

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

Check that any given schema exists.

Parameters

$schema: The name of the schema to check the existence of

Return value

TRUE/FALSE depending upon whether or not the schema exists

Related topics

3 calls to chado_dbschema_exists()
tripal_chado_install_sql in tripal_chado/includes/tripal_chado.install.inc
Execute the provided SQL
tripal_chado_reset_chado_schema in tripal_chado/includes/tripal_chado.install.inc
Reset the Chado Schema This drops the current chado and chado-related schema and re-creates it
tripal_core_schema_exists in legacy/tripal_core/api/tripal_core.DEPRECATED.inc
1 string reference to 'chado_dbschema_exists'

File

tripal_chado/api/tripal_chado.schema.api.inc, line 258
Provides an application programming interface (API) for describing Chado tables.

Code

function chado_dbschema_exists($schema) {

  $sql = "
    SELECT nspname
    FROM pg_namespace
    WHERE
      has_schema_privilege(nspname, 'USAGE') AND
      nspname = :nspname
    ORDER BY nspname
  ";
  $schema = db_query($sql, array(':nspname' => $schema))->fetchField();
  if ($schema) {
    return TRUE;
  }
  return FALSE;
}