// BuildSelect generates a SELECT clause from the given selected column names.
760707
func (q *BaseQueryBuilder) BuildSelect(cols []string, distinct bool, option string) string {
	var s bytes.Buffer
	s.WriteString("SELECT ")
	if distinct {
		s.WriteString("DISTINCT ")
	}
	if option != "" {
		s.WriteString(option)
		s.WriteString(" ")
	}
	if len(cols) == 0 {
		s.WriteString("*")
		return s.String()
	}

	for i, col := range cols {
		if i > 0 {
			s.WriteString(", ")
		}
		matches := selectRegex.FindStringSubmatch(col)
		if len(matches) == 0 {
			s.WriteString(q.db.QuoteColumnName(col))
		} else {
			col := col[:len(col)-len(matches[0])]
			alias := matches[1]
			s.WriteString(q.db.QuoteColumnName(col) + " AS " + q.db.QuoteSimpleColumnName(alias))
		}
	}

	return s.String()
}
488952
func (t *Table) GetSelection() (row, column int) {
	return t.selectedRow, t.selectedColumn
}
470027
func Select(listener func(*vecty.Event)) *vecty.EventListener {
	return &vecty.EventListener{Name: "select", Listener: listener}
}
171740
func (me *Dataset) ClearSelect() *Dataset {
	ret := me.copy()
	ret.clauses.Select = cols(Literal("*"))
	ret.clauses.SelectDistinct = nil
	return ret
}
805453
func (c *Connection) Select(q *Query) (*SelectResponse, error) {
	resp, err := c.CustomSelect(q, "select")
	return resp, err
}
620667
func ParseSqlSelect(sqlQuery string) (*SqlSelect, error) {
	stmt, err := ParseSql(sqlQuery)
	if err != nil {
		return nil, err
	}
	sel, ok := stmt.(*SqlSelect)
	if !ok {
		return nil, fmt.Errorf("Expected SqlSelect but got %T", stmt)
	}
	return sel, nil
}
905385
func buildSelectColumnList(t *schema.Table) string {
	buf := sqlparser.NewTrackedBuffer(nil)
	for i, c := range t.MessageInfo.Fields {
		// Column names may have to be escaped.
		if i == 0 {
			buf.Myprintf("%v", sqlparser.NewColIdent(c.Name))
		} else {
			buf.Myprintf(", %v", sqlparser.NewColIdent(c.Name))
		}
	}
	return buf.String()
}
1079687
func (s *QueryInput) SetSelect(v string) *QueryInput {
	s.Select = &v
	return s
}
273964
func (*CompressionSelector) Select(r *http.Request) Encoder {
	encHeader := r.Header.Get("Accept-Encoding")
	encTypes := strings.FieldsFunc(encHeader, func(r rune) bool {
		return unicode.IsSpace(r) || r == ','
	})

	for _, enc := range encTypes {
		switch enc {
		case "gzip":
			return &gzipEncoder{}
		case "deflate":
			return &flateEncoder{}
		}
	}

	return DefaultEncoder
}
1153285
func (s *Statement) Select(str string) *Statement {
	s.selectStr = str
	return s
}
1280226
func (db *SQLDB) getSelectQuery(table *types.SQLTable, height uint64) (string, error) {

	fields := ""

	for _, tableColumn := range table.Columns {
		if fields != "" {
			fields += ", "
		}
		fields += db.DBAdapter.SecureName(tableColumn.Name)
	}

	if fields == "" {
		return "", errors.New("error table does not contain any fields")
	}

	query := db.DBAdapter.SelectRowQuery(table.Name, fields, strconv.FormatUint(height, 10))
	return query, nil
}
594186
func (q *QCow2) selectPart(sectorNum int64) {
	for (sectorNum - q.srcCurOffset) >= int64(BEUvarint64(uint64(q.srcSectors))[q.srcCur]) {
		q.srcCurOffset += int64(BEUvarint64(uint64(q.srcSectors))[q.srcCur])
		q.srcCur++
	}
}
812242
func (me *DefaultAdapter) SelectSql(buf *SqlBuilder, cols ColumnList) error {
	buf.Write(me.SelectClause)
	buf.WriteRune(space_rune)
	if len(cols.Columns()) == 0 {
		buf.WriteRune(star_rune)
	} else {
		return me.Literal(buf, cols)
	}
	return nil
}
465613
func SqlSelectFromPb(pb *SqlSelectPb) *SqlSelect {
	ss := SqlSelect{
		Db:        pb.GetDb(),
		Raw:       pb.GetRaw(),
		Star:      pb.GetStar(),
		Distinct:  pb.GetDistinct(),
		Alias:     pb.GetAlias(),
		Limit:     int(pb.GetLimit()),
		Offset:    int(pb.GetOffset()),
		isAgg:     pb.GetIsAgg(),
		finalized: pb.GetFinalized(),
		schemaqry: pb.GetSchemaqry(),
	}
	if pb.Into != nil {
		ss.Into = &SqlInto{pb.GetInto()}
	}
	if pb.Where != nil {
		ss.Where = SqlWhereFromPb(pb.GetWhere())
	}
	if pb.Having != nil {
		ss.Having = expr.NodeFromNodePb(pb.GetHaving())
	}
	if pb.Projection != nil {
		ss.proj = ProjectionFromPb(pb.GetProjection())
	}
	if len(pb.Columns) > 0 {
		ss.Columns = ColumnsFromPb(pb.GetColumns())
	}
	if len(pb.GroupBy) > 0 {
		ss.GroupBy = ColumnsFromPb(pb.GetGroupBy())
	}
	if len(pb.OrderBy) > 0 {
		ss.OrderBy = ColumnsFromPb(pb.GetOrderBy())
	}
	if len(pb.From) > 0 {
		ss.From = make([]*SqlSource, len(pb.From))
		for i, fpb := range pb.From {
			ss.From[i] = SqlSourceFromPb(fpb)
		}
	}
	if len(pb.With) > 0 {
		ss.With = make(u.JsonHelper)
		json.Unmarshal(pb.With, &ss.With)
	}
	return &ss
}
408926
func (query Query) Select(fields ...string) Query {
	query.Fields = fields
	return query
}
243645
func (s *RedshiftDataSpec) SetSelectSqlQuery(v string) *RedshiftDataSpec {
	s.SelectSqlQuery = &v
	return s
}
1042592
func (q *FileSource) Select(fields ...string) *FileSource {
	q.Fields = fields
	return q
}