Browse Source

Add a simple check on chado_udpate_record

Stephen Ficklin 10 years ago
parent
commit
6cfc110816
1 changed files with 7 additions and 1 deletions
  1. 7 1
      tripal_core/api/tripal_core.chado_query.api.inc

+ 7 - 1
tripal_core/api/tripal_core.chado_query.api.inc

@@ -595,9 +595,15 @@ function chado_update_record($table, $match, $values, $options = NULL) {
   $update_values = array();   // contains the values to be updated
   $update_matches = array();  // contains the values for the where clause
 
-
   // get the table description
   $table_desc = chado_get_schema($table);
+  if (!$table_desc) {
+    tripal_report_error('tripal_core', TRIPAL_ERROR,
+      'The table name, %table, does not exist.',
+      array('%table', $table), array('print' => $print_errors)
+    );
+    return FALSE;
+  }
 
   // if the user wants us to return the record then we need to get the
   // unique primary key if one exists.  That way we can add it to the