function chado_select_record_check_value_type

2.x chado_select_record_check_value_type(&$op, &$value, $type)

Helper Function: check that the value is the correct type.

This function is used by chado_select_record() when building the $where clause array to ensure that any single values are the correct type based on the table definition. Furthermore, it ensures that NULL's are caught changing the operator to 'IS NULL'.

     $op = '=';
     chado_select_record_check_value_type($op, $value, $table_desc['fields'][$field]['type']);

     $where[] = array(
       'field' => $field,
       'op' => $op,
       'data' => $value


$op: The operator being used. This is mostly passed in to allow it to be changed if a NULL value is detected.

$value: The value to be checked and adjusted.

$type: The type from the table definition that's used to determine the type of value.

Related topics

1 call to chado_select_record_check_value_type()
chado_select_record in tripal_core/api/
Provides a generic routine for selecting data from a Chado table


tripal_core/api/, line 1440
Provides an API for querying of chado including inserting, updating, deleting and selecting from chado.


function chado_select_record_check_value_type(&$op, &$value, $type) {

  if ($value === NULL) {
    $op = 'IS NULL';
  elseif ($type == 'int') {
    $value = (int) $value;