Processes columns and properly quote them if necessary.
It will join all columns into a string with comma as separators.
@param string|array $columns the columns to be processed
@return string the processing result
557664
public function buildColumns($columns)
    {
        if (!is_array($columns)) {
            if (strpos($columns, '(') !== false) {
                return $columns;
            } else {
                $columns = preg_split('/\s*,\s*/', $columns, -1, PREG_SPLIT_NO_EMPTY);
            }
        }
        foreach ($columns as $i => $column) {
            if ($column instanceof Expression) {
                $columns[$i] = $column->expression;
            } elseif (strpos($column, '(') === false) {
                $columns[$i] = $this->db->quoteColumnName($column);
            }
        }

        return is_array($columns) ? implode(', ', $columns) : $columns;
    }
626854
public function columns(array $columns)
    {
        foreach ($columns as $column => $value) {
            $this->column($column, $value);
        }

        return $this;
    }
654499
protected function sanitizeColumns(array $columns)
    {
        $callback = $this->getCallback();
        if ($callback) {
            foreach ($columns as $key => $value) {
                $columns[$key] = $callback($value);
            }
        }

        if (!$this->enclosure) {
            return $columns;
        }

        foreach ($columns as $key => $value) {
            if (false !== strpos($value, $this->delimiter)
                || false !== strpos($value, $this->escape)
                || false !== strpos($value, $this->enclosure)
                || false !== strpos($value, $this->newline)
            ) {
                if ($this->escape != $this->enclosure) {
                    $value = str_replace($this->escape, $this->escape . $this->escape, $value);
                }
                $value = str_replace($this->enclosure, $this->escape . $this->enclosure, $value);
                $value = $this->enclosure . $value . $this->enclosure;

                $columns[$key] = $value;
            }
        }

        return $columns;
    }
705695
public function columns(array $columns): self
    {
        foreach ($columns as $name => $alias) {
            if (!is_string($name)) {
                $this->column($alias, null);
                continue;
            }
            if (is_string($alias)) {
                $this->column($name, $alias);
            } else {
                $this->column($alias, $name);
            }
        }
        return $this;
    }
787700
public function processColumnListing($results)
    {
        $mapping = function ($r) {
            $r = (object) $r;

            return $r->column_name;
        };

        return array_map($mapping, $results);
    }
672728
public function select($columns)
    {
        if (is_array($columns)) {
            $this->columns = $columns;
        } elseif ($columns === '*') {
            $this->columns = ['*'];
        }
        return $this;
    }
723864
private function transformColumns($columns)
    {
        return array_map(function ($column) {
            return [
                'Field' => $column->Field,
                'Type' => $column->Type,
                'Null' => $column->Null,
                'Key' => $column->Key,
                'Default' => $column->Default,
                'Extra' => $column->Extra
            ];
        }, $columns);
    }
1191906
public function get($columns = ['*'])
    {
        $columns = $this->query->getQuery()->columns ? [] : $columns;

        if ($columns === ['*']) {
            $columns = [$this->related->getTable().'.*'];
        }

        $columns[] = $this->getQualifiedFirstLocalKeyName().' as '.static::THROUGH_KEY;

        $this->query->addSelect($columns);

        return $this->query->get();
    }
974789
public function select($columns= '*') {
        if (!is_array($columns)) {
            $columns= trim($columns);
            if ($columns == '*' || $columns === $this->_alias . '.*' || $columns === $this->xpdo->escape($this->_alias) . '.*') {
                $columns= $this->xpdo->getSelectColumns($this->_class, $this->_alias, $this->_alias . '_');
            }
            $columns= explode(',', $columns);
            foreach ($columns as $colKey => $column) $columns[$colKey] = trim($column);
        }
        if (is_array ($columns)) {
            if (!is_array($this->query['columns'])) {
                $this->query['columns']= $columns;
            } else {
                $this->query['columns']= array_merge($this->query['columns'], $columns);
            }
        }
        return $this;
    }
653329
public function columns($columns)
    {
        if (!is_array($columns)) {
            $columns = preg_split('~\s*,\s*~', trim($columns));
        }

        $this->columns = $columns;

        return $this;
    }
725354
public function columns(array $columns)
    {
        foreach ($columns as $name => $value) {
            $this->columns[$this->grammar->buildId($name)] = $value;
        }

        return $this;
    }
680055
public function setColumns($columns)
    {
        $columns = is_array($columns) ? $columns : func_get_args();

        if (count($columns) > 0) {
            $this->columns = implode(', ', $columns);
        }
    }
63581
public function uSortMultipleColumn($columns)
    {
        $dataFormats = $this->dataFormats;
        $sort = function ($a, $b) use ($columns, $dataFormats) {
            foreach ($columns as $colName => $fn) {
                $tmp = $fn($a[$colName], $b[$colName]);
                if ($tmp !== 0) {
                    return $tmp;
                }
            }
            return 0;
        };

        uasort($this->data, $sort);
        return $this;
    }
171070
private function prepareColumn(array $column)
    {
        if ($column['sql'] instanceof self) {
            [$sql, $params] = $column['sql']->toSql();

            $column['sql'] = '(' . $sql . ')';

            $column['params'] = $params;
        }

        return $column;
    }
309224
public function Columns($columns = ''): QueryBuilder
    {
        if (empty($columns)) {
            return $this;
        }
        
        if (! is_array($columns)) {
            $this->fields = explode(',', $columns);
        }
        
        $this->fields = array_map('trim', $this->fields);
        
        return $this;
    }
133400
protected function handleColumns(array $columns)
    {
        if (empty($columns)) {
            return '*';
        }

        $sql = [];

        foreach ($columns as $column) {
            if ($column['alias'] !== null) {
                $sql[] = $this->wrap($column['name']) . ' AS ' . $this->wrap($column['alias']);
            } else {
                $sql[] = $this->wrap($column['name']);
            }
        }
        return implode(', ', $sql);
    }
990724
public function columns($columns = '*')
    {
        if ('*' == $columns) {
            $this->columns = ['*'];
        } else {
            $columns = $this->prepareNames(func_get_args());
            $this->columns = array_values(array_diff($columns, ['*']));
        }
        return $this;
    }