Browse Source

Fixed bug in tripal_core_chado_execute_prepared when checking if a field is 'text'. Rather than cause an error if the value is not text, it automatically converts it to text

spficklin 12 years ago
parent
commit
33f7af8e70
1 changed files with 4 additions and 1 deletions
  1. 4 1
      tripal_core/api/tripal_core_chado.api.inc

+ 4 - 1
tripal_core/api/tripal_core_chado.api.inc

@@ -3101,12 +3101,15 @@ function tripal_core_chado_execute_prepared($statement_name, $sql, $values) {
       if (isset($required_values[$k])) {
       if (isset($required_values[$k])) {
         switch ($required_values[$k]) {
         switch ($required_values[$k]) {
           case 'text':
           case 'text':
+            // anything can be converted to a string, so if the type is 'text' let's just convert it
+            $values[$k] = (string) $v;
+            /*
             $check = is_string($v);
             $check = is_string($v);
             if ($v != '' and !$check) {
             if ($v != '' and !$check) {
               watchdog('tripal_core', "chado_execute_prepared: wrong argument type supplied for '%name' statement, field %k. Expected %required but recieved '%value'",
               watchdog('tripal_core', "chado_execute_prepared: wrong argument type supplied for '%name' statement, field %k. Expected %required but recieved '%value'",
                 array('%name' => $statement_name, '%k' => $k+1, '%required' => $required_values[$k], '%value' => print_r($v, TRUE)), WATCHDOG_ERROR);
                 array('%name' => $statement_name, '%k' => $k+1, '%required' => $required_values[$k], '%value' => print_r($v, TRUE)), WATCHDOG_ERROR);
               return FALSE;
               return FALSE;
-            }
+            } */
             break;
             break;
           case 'int':
           case 'int':
             $check = is_numeric($v);
             $check = is_numeric($v);