function tripal_core_get_chado_tables
2.x tripal_core.DEPRECATED.api.inc | tripal_core_get_chado_tables($include_custom = NULL) |
3.x tripal_core.DEPRECATED.inc | tripal_core_get_chado_tables($include_custom = NULL) |
1.x tripal_core_chado.api.inc | tripal_core_get_chado_tables($include_custom = NULL) |
Retrieves the list tables in the Chado schema. By default it only retursn the default Chado tables, but may also return custom tables added to the Chado schema as well.
@returns An associative array where the key and value pairs are the Chado table names.
Parameters
$include_custom: Optional. Set as TRUE to include any custom tables created in the Chado schema. Custom tables are added to Chado using the tripal_core_chado_create_table() function.
Related topics
6 calls to tripal_core_get_chado_tables()
- get_chado_fk_relationships in tripal_core/
api/ get_FKs.php - tripal_bulk_loader_add_template_field_form in tripal_bulk_loader/
includes/ tripal_bulk_loader.admin.templates.inc - Add Field Form
- tripal_bulk_loader_edit_template_field_form in tripal_bulk_loader/
includes/ tripal_bulk_loader.admin.templates.inc - Edit Field Form
- tripal_bulk_loader_edit_template_record_form in tripal_bulk_loader/
includes/ tripal_bulk_loader.admin.templates.inc - Edit Record Form
- tripal_views_integrate_all_chado_tables in tripal_views/
api/ tripal_views.api.inc - Integrate all chado tables in the schema api. This integration only occurs once and sets all Chado tables to a priority of 10
File
- tripal_core/
api/ tripal_core_chado.api.inc, line 3451 - The Tripal Core API
Code
function tripal_core_get_chado_tables($include_custom = NULL) {
// first get the chado version that is installed
$v = tripal_core_get_chado_version();
$tables = array();
if ($v == '1.2') {
$tables_v1_2 = tripal_core_chado_get_v1_2_tables();
foreach ($tables_v1_2 as $table) {
$tables[$table] = $table;
}
}
if ($v == '1.11' or $v == '1.11 or older') {
$tables_v1_11 = tripal_core_chado_get_v1_11_tables();
foreach ($tables_v1_11 as $table) {
$tables[$table] = $table;
}
}
// now add in the custom tables too if requested
if ($include_custom) {
$sql = "SELECT table_name FROM {tripal_custom_tables}";
$resource = db_query($sql);
while ($r = db_fetch_object($resource)) {
$tables[$r->table_name] = $r->table_name;
}
}
asort($tables);
return $tables;
}