CI_DB_query_builder::_merge_cache PHP Method

_merge_cache() protected method

When called, this function merges any cached QB arrays with locally called ones.
protected _merge_cache ( ) : void
return void
    protected function _merge_cache()
    {
        if (count($this->qb_cache_exists) === 0) {
            return;
        } elseif (in_array('select', $this->qb_cache_exists, TRUE)) {
            $qb_no_escape = $this->qb_cache_no_escape;
        }
        foreach (array_unique($this->qb_cache_exists) as $val) {
            $qb_variable = 'qb_' . $val;
            $qb_cache_var = 'qb_cache_' . $val;
            $qb_new = $this->{$qb_cache_var};
            for ($i = 0, $c = count($this->{$qb_variable}); $i < $c; $i++) {
                if (!in_array($this->{$qb_variable}[$i], $qb_new, TRUE)) {
                    $qb_new[] = $this->{$qb_variable}[$i];
                    if ($val === 'select') {
                        $qb_no_escape[] = $this->qb_no_escape[$i];
                    }
                }
            }
            $this->{$qb_variable} = $qb_new;
            if ($val === 'select') {
                $this->qb_no_escape = $qb_no_escape;
            }
        }
        // If we are "protecting identifiers" we need to examine the "from"
        // portion of the query to determine if there are any aliases
        if ($this->_protect_identifiers === TRUE && count($this->qb_cache_from) > 0) {
            $this->_track_aliases($this->qb_from);
        }
    }