function chado_dbschema_exists

2.x tripal_core.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_core_install_sql in tripal_core/includes/tripal_core.chado_install.inc
Execute the provided SQL
tripal_core_reset_chado_schema in tripal_core/includes/tripal_core.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 tripal_core/api/tripal_core.DEPRECATED.api.inc
1 string reference to 'chado_dbschema_exists'

File

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

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;
}