Generates a select string used in participantsString().

@param array $columns

@return string
166716
protected function createSelectString($columns)
    {
        $dbDriver = $this->getConnection()->getDriverName();
        $tablePrefix = $this->getConnection()->getTablePrefix();
        $usersTable = Models::table('users');

        switch ($dbDriver) {
        case 'pgsql':
        case 'sqlite':
            $columnString = implode(" || ' ' || " . $tablePrefix . $usersTable . '.', $columns);
            $selectString = '(' . $tablePrefix . $usersTable . '.' . $columnString . ') as name';
            break;
        case 'sqlsrv':
            $columnString = implode(" + ' ' + " . $tablePrefix . $usersTable . '.', $columns);
            $selectString = '(' . $tablePrefix . $usersTable . '.' . $columnString . ') as name';
            break;
        default:
            $columnString = implode(", ' ', " . $tablePrefix . $usersTable . '.', $columns);
            $selectString = 'concat(' . $tablePrefix . $usersTable . '.' . $columnString . ') as name';
        }

        return $selectString;
    }
1197780
public function select($columns = [])
    {
        $columns = is_array($columns) ? $columns : func_get_args();

        if (! empty($columns)) {
            $this->columns = $columns;
        }

        return $this;
    }
1174785
public static function generateQueryString(array $parts)
    {
        $return = "";

        foreach ($parts as $part) {
            if ($part instanceof Column) {
                if ($part->getColumnName() === '*') {
                    $return .= "*";
                } else {
                    $return .= "`{$part->getColumnName()}`"; // @codeCoverageIgnore
                }

                if ($part->getColumnAs() !== null) {
                    $return .= " " . $part->getColumnAs(); // @codeCoverageIgnore
                }

                $return .= ",";
            }
        }

        return ($return !== "" ? substr($return, 0, -1) : "*");
    }
663767
public static function select(array $columns = ['*'], ...$joinsColumns)
    {
        $query               = new static(Query\Type::SELECT);
        $query->columns['t'] = $columns;

        $alias = 'j1';
        foreach ($joinsColumns as $joinColumns) {
            $query->columns[$alias] = (array)$joinColumns;
            $alias++;
        }

        return $query;
    }
994141
public function generateIndexName($columns)
    {
        $parts = [];
        foreach ($columns as $column => $order) {
            $parts[] = $column . '_' . $order;
        }
        return implode('_', $parts);
    }
162649
protected function handleSetColumns(array $columns)
    {
        if (empty($columns)) {
            return '';
        }

        $sql = [];

        foreach ($columns as $column) {
            $sql[] = $this->wrap($column['column']) . ' = ' . $this->param($column['value']);
        }

        return ' SET ' . implode(', ', $sql);
    }
1218697
protected function formatColumns($columns) : string {
    if (is_string($columns)) {
      if ($columns === '*') {
        return $columns;
      }

      $columns = explode(',', $columns);

      $columns = array_map(function ($column) {
        return '`' . trim($column) . '`';
      }, $columns);

      return implode(', ', $columns);
    }

    if (is_array($columns)) {
      return '`' . implode('`, `', $columns) . '`';
    }
  }
147710
protected function getMaxColumnLength(array $columns): int
  {
    $length = 0;
    foreach ($columns as $column)
    {
      $length = max(mb_strlen($column['column_name']), $length);
    }

    return $length;
  }
1085372
public function filterAndConvertToArray($columns)
    {
        $this->columns = [];
        $columns = explode(',', $columns);

        foreach ($columns as $column) {
            try {
                list($col, $val) = explode(':', $column, self::EXPLODE_MAX_LIMIT);
            } catch (\Exception $e) {
                throw new \Exception('Unable to explode columns based on ":" separator');
            }

            $val = $this->checkForKeyword(trim($val));
            $this->columns[trim($col)] = $val;
        }

        return $this;
    }
1047658
protected function _addSelect(array $columns) {
		if(array_values($columns) === $columns) {
			foreach($columns as $k=>$v) {
				unset($columns[$k]);
				$columns[$v] = $v;
			}
		}
		$this->columns = array_merge($this->columns, $columns);
		return $this;
	}
705408
public function select(...$columns): Query\SelectQuery
    {
        $query = $this->engine->makeSelect();
        if (empty($columns) === false) {
            $query = $query->columns(...$columns);
        }
        return $query;
    }
1089764
protected function getSelectColumns(array $columns = array('*'))
	{
		if ($columns == array('*'))
		{
			$columns = array($this->related->getTable().'.*');
		}

		return array_merge($columns, array($this->parent->getTable().'.'.$this->firstKey));
	}
367019
protected function _getColumnIndexInSelectQuery($col)
    {
        $_columns = $this->_extractColumnsFromSelectQuery();

        $_columnIndex = false;
        foreach ($_columns as $index => $column) {
            if ($col == $column) {
                $_columnIndex = $index;
                break;
            }
        }
        return $_columnIndex;
    }
320372
protected function createIndexName($type, array $columns)
    {
        $index = strtolower($this->table.'_'.implode('_', $columns).'_'.$type);

        return str_replace(array('-', '.'), '_', $index);
    }
1190725
protected function fetchColumnValue($data, $columns)
    {
        if (is_string($columns)) {
            return Arr::get($data, $columns);
        }

        if (is_array($columns)) {
            $value = [];
            foreach ($columns as $name => $column) {
                if (!Arr::has($data, $column)) {
                    continue;
                }
                $value[$name] = Arr::get($data, $column);
            }

            return $value;
        }
    }
301894
public function getSelectionAlias($column)
        {
            if (!is_numeric($column) && !is_string($column)) {
                if (is_array($column) && array_key_exists('column', $column)) {
                    $column = $column['column'];
                } else {
                    throw new Exception('Invalid column!');
                }
            }
            if (!isset($this->aliases[$column])) {
                $this->aliases[$column] = str_replace('.', '_', $column);
            }

            return $this->aliases[$column];
        }
1346448
public function select($columns = '*'): SelectQuery
    {
        return $this->database->select(func_num_args() ? func_get_args() : '*')->from($this->name);
    }