Ver código fonte

Fixed a error caused by too many db connections

Chun-Huai Cheng 7 anos atrás
pai
commit
acea4b204a
1 arquivos alterados com 3 adições e 2 exclusões
  1. 3 2
      tripal_chado/api/tripal_chado.api.inc

+ 3 - 2
tripal_chado/api/tripal_chado.api.inc

@@ -381,11 +381,12 @@ function tripal_get_chado_entity_id ($chado_table, $record_id) {
   // type_column, and type_id.
   $bundle_id = NULL;
   if ($type_column) {
-    $pkey = $chado_table . "_id";
+    $schema = chado_get_schema($chado_table);
+    $pkey = is_array($schema['primary key']) ? $schema['primary key'][0] : $schema['primary key'];
     $type_id = NULL;
     if (key_exists($type_column, $schema['fields'])) {
       $type_id =
-        chado_db_select($chado_table, 'C')
+        db_select("chado.$chado_table", 'C')
           ->fields('C', array($type_column))
           ->condition($pkey, $record_id)
           ->execute()