function chado_get_custom_table_id

2.x tripal_core.custom_tables.api.inc chado_get_custom_table_id($table_name)
3.x tripal_chado.custom_tables.api.inc chado_get_custom_table_id($table_name)

Retrieve the custom table id given the name

Parameters

$table_name: The name of the custom table

Return value

The unique identifier for the given table

Related topics

1 call to chado_get_custom_table_id()
1 string reference to 'chado_get_custom_table_id'

File

tripal_core/api/tripal_core.custom_tables.api.inc, line 275
Provides an API to manage custom tables in Chado.

Code

function chado_get_custom_table_id($table_name) {
  if (db_table_exists('tripal_custom_tables')) {
    $sql = "SELECT * FROM {tripal_custom_tables} WHERE table_name = :table_name";
    $results = db_query($sql, array(':table_name' => $table_name));
    $custom_table = $results->fetchObject();
    if ($custom_table) {
      return $custom_table->table_id;
    }
  }

  return FALSE;
}