CI_DB_query_builder::_where_in PHP Method

_where_in() protected method

Internal WHERE IN
protected _where_in ( string $key = NULL, array $values = NULL, boolean $not = FALSE, string $type = 'AND ', boolean $escape = NULL ) : CI_DB_query_builder
$key string The field to search
$values array The values searched on
$not boolean If the statement would be IN or NOT IN
$type string
$escape boolean
return CI_DB_query_builder
    protected function _where_in($key = NULL, $values = NULL, $not = FALSE, $type = 'AND ', $escape = NULL)
    {
        if ($key === NULL or $values === NULL) {
            return $this;
        }
        if (!is_array($values)) {
            $values = array($values);
        }
        is_bool($escape) or $escape = $this->_protect_identifiers;
        $not = $not ? ' NOT' : '';
        if ($escape === TRUE) {
            $where_in = array();
            foreach ($values as $value) {
                $where_in[] = $this->escape($value);
            }
        } else {
            $where_in = array_values($values);
        }
        $prefix = count($this->qb_where) === 0 && count($this->qb_cache_where) === 0 ? $this->_group_get_type('') : $this->_group_get_type($type);
        $where_in = array('condition' => $prefix . $key . $not . ' IN(' . implode(', ', $where_in) . ')', 'escape' => $escape);
        $this->qb_where[] = $where_in;
        if ($this->qb_caching === TRUE) {
            $this->qb_cache_where[] = $where_in;
            $this->qb_cache_exists[] = 'where';
        }
        return $this;
    }