function tripal_is_table_integrated

2.x tripal_views.api.inc tripal_is_table_integrated($table_name, $priority = NULL)
3.x tripal_chado_views.api.inc tripal_is_table_integrated($table_name, $priority = NULL)

Check to see if this table already has an integration record with the given priority.

Parameters

$table_name: The name of the table to check for integration

$priority (optional): The priority of record to check for

Return value

If the table is already integrated, the setup_id of the existing integration record is returned (If priority is not specified this will be the lightest record); Otherwise the table is not already integrated and FALSE is returned.

Related topics

3 calls to tripal_is_table_integrated()
tripal_chado_views_integrate_all_chado_tables in tripal_chado_views/includes/tripal_chado_views_integration.inc
Integrate all chado tables in the schema api. This integration only occurs once and sets all Chado tables to a priority of 10
tripal_chado_views_is_integrated in tripal_chado_views/api/tripal_chado_views.DEPRECATED.inc
tripal_make_view_compatible_with_external in tripal_chado_views/api/tripal_chado_views.api.inc
Remove any drupal fields from a chado-based default view definition if chado is external. This ensures compatibility with an external chado database.
1 string reference to 'tripal_is_table_integrated'

File

tripal_chado_views/api/tripal_chado_views.api.inc, line 360
Provides API functions that support direct integration of Chado tables with Drupal Views.

Code

function tripal_is_table_integrated($table_name, $priority = NULL) {

  if ($priority) {
    // D7 TODO: Check DBTNG changes work.
    $sql = "SELECT setup_id FROM {tripal_views} WHERE table_name=:table AND priority=:priority";
    $setup = db_query($sql, array(':table' => $table_name, ':priority' => $priority));
    $setup = $setup->fetchObject();
  }
  else {
    // D7 TODO: Check DBTNG changes work.
    $sql = "SELECT setup_id FROM {tripal_views} WHERE table_name=:table ORDER BY priority ASC";
    $setup = db_query($sql, array(':table' => $table_name));
    $setup = $setup->fetchObject();
  }
  if ($setup) {
    return $setup->setup_id;
  }
  else {
    return FALSE;
  }
}