Quellcode durchsuchen

Add a simple check on other chado_xxx_record functions

Stephen Ficklin vor 9 Jahren
Ursprung
Commit
adca4f065c
1 geänderte Dateien mit 12 neuen und 0 gelöschten Zeilen
  1. 12 0
      tripal_core/api/tripal_core.chado_query.api.inc

+ 12 - 0
tripal_core/api/tripal_core.chado_query.api.inc

@@ -825,6 +825,12 @@ function chado_delete_record($table, $match, $options = NULL) {
   // get the table description
   // get the table description
   $table_desc = chado_get_schema($table);
   $table_desc = chado_get_schema($table);
   $fields = $table_desc['fields'];
   $fields = $table_desc['fields'];
+  if (empty($table_desc)) {
+    tripal_report_error('tripal_core', TRIPAL_WARNING,
+      'chado_insert_record; There is no table description for !table_name',
+      array('!table_name' => $table), array('print' => $print_errors)
+    );
+  }
 
 
   // get the values needed for matching in the SQL statement
   // get the values needed for matching in the SQL statement
   foreach ($match as $field => $value) {
   foreach ($match as $field => $value) {
@@ -1074,6 +1080,12 @@ function chado_select_record($table, $columns, $values, $options = NULL) {
 
 
   // Get the table description.
   // Get the table description.
   $table_desc = chado_get_schema($table);
   $table_desc = chado_get_schema($table);
+  if (empty($table_desc)) {
+    tripal_report_error('tripal_core', TRIPAL_WARNING,
+      'chado_insert_record; There is no table description for !table_name',
+      array('!table_name' => $table), array('print' => $print_errors)
+    );
+  }
 
 
   $select = '';
   $select = '';
   $from = '';
   $from = '';