CI_DB_active_record::_where_in PHP Method

_where_in() public method

Called by where_in, where_in_or, where_not_in, where_not_in_or
public _where_in ( $key = NULL, $values = NULL, $not = FALSE, $type = 'AND ' ) : object
return object
    function _where_in($key = NULL, $values = NULL, $not = FALSE, $type = 'AND ')
    {
        if ($key === NULL or $values === NULL) {
            return;
        }
        if (!is_array($values)) {
            $values = array($values);
        }
        $not = $not ? ' NOT' : '';
        foreach ($values as $value) {
            $this->ar_wherein[] = $this->escape($value);
        }
        $prefix = count($this->ar_where) == 0 ? '' : $type;
        $where_in = $prefix . $this->_protect_identifiers($key) . $not . " IN (" . implode(", ", $this->ar_wherein) . ") ";
        $this->ar_where[] = $where_in;
        if ($this->ar_caching === TRUE) {
            $this->ar_cache_where[] = $where_in;
            $this->ar_cache_exists[] = 'where';
        }
        // reset the array for multiple calls
        $this->ar_wherein = array();
        return $this;
    }