// executeSelect runs the given select statement
198564
func (mp *Proxy) executeSelect(ctx context.Context, session *ProxySession, sql string, bindVariables map[string]*querypb.BindVariable) (*sqltypes.Result, error) {
	if mp.normalize {
		query, comments := sqlparser.SplitMarginComments(sql)
		stmt, err := sqlparser.Parse(query)
		if err != nil {
			return nil, err
		}
		sqlparser.Normalize(stmt, bindVariables, "vtp")
		normalized := sqlparser.String(stmt)
		sql = comments.Leading + normalized + comments.Trailing
	}

	return mp.qs.Execute(ctx, mp.target, sql, bindVariables, session.TransactionID, session.Options)
}
1153285
func (s *Statement) Select(str string) *Statement {
	s.selectStr = str
	return s
}
679669
func (rb *route) PushSelect(expr *sqlparser.AliasedExpr, _ builder) (rc *resultColumn, colnum int, err error) {
	sel := rb.Select.(*sqlparser.Select)
	sel.SelectExprs = append(sel.SelectExprs, expr)

	rc = newResultColumn(expr, rb)
	rb.resultColumns = append(rb.resultColumns, rc)

	return rc, len(rb.resultColumns) - 1, nil
}
443100
func (f *fsClient) Select(expression string, sse encrypt.ServerSide, opts SelectObjectOpts) (io.ReadCloser, *probe.Error) {
	return nil, probe.NewError(APINotImplemented{})
}
1064036
func (rev *Revocation) Select(tx *sql.Tx) error {
	row := tx.QueryRow(`SELECT revoked_at, mechanism, reason FROM revocations WHERE ski=?`, rev.SKI)
	err := row.Scan(&rev.RevokedAt, &rev.Mechanism, &rev.Reason)
	if err != nil {
		return err
	}

	return nil
}
1043926
func (q *Query) Select(values ...interface{}) error {
	if q.stickyErr != nil {
		return q.stickyErr
	}

	model, err := q.newModel(values...)
	if err != nil {
		return err
	}

	q, err = model.BeforeSelectQuery(q.ctx, q.db, q)
	if err != nil {
		return err
	}

	res, err := q.query(model, newSelectQuery(q))
	if err != nil {
		return err
	}

	if res.RowsReturned() > 0 {
		if q.model != nil {
			if err := q.selectJoins(q.model.GetJoins()); err != nil {
				return err
			}
		}
		if err := model.AfterSelect(q.ctx, q.db); err != nil {
			return err
		}
	}

	return nil
}
408926
func (query Query) Select(fields ...string) Query {
	query.Fields = fields
	return query
}
564820
func (s *SelectQuery) AndSelect(cols ...string) *SelectQuery {
	s.selects = append(s.selects, cols...)
	return s
}
659076
func SELECT(entity interface{}, afterKeyword Expression, binding ...interface{}) Expression {
	return &PrefixedExp{"SELECT", []Expression{FROM(entity, afterKeyword)}, "", binding}
}
343335
func (n *NamedStmt) Select(dest interface{}, arg interface{}) error {
	rows, err := n.Queryx(arg)
	if err != nil {
		return err
	}
	// if something happens here, we want to make sure the rows are Closed
	defer rows.Close()
	return scanAll(rows, dest, false)
}
111546
func (c *Column) SetSelectSQL(s string) {
	c.SelectSQL = s
	c.Writeable = false
	c.Readable = true
}
621616
func (client *QueryClient) ExecuteBatch(queries []*querypb.BoundQuery, asTransaction bool) ([]sqltypes.Result, error) {
	return client.server.ExecuteBatch(
		client.ctx,
		&client.target,
		queries,
		asTransaction,
		client.transactionID,
		&querypb.ExecuteOptions{IncludedFields: querypb.ExecuteOptions_ALL},
	)
}
94460
func (sq *subquery) PushSelect(expr *sqlparser.AliasedExpr, _ builder) (rc *resultColumn, colnum int, err error) {
	col, ok := expr.Expr.(*sqlparser.ColName)
	if !ok {
		return nil, 0, errors.New("unsupported: expression on results of a cross-shard subquery")
	}

	// colnum should already be set for subquery columns.
	inner := col.Metadata.(*column).colnum
	sq.esubquery.Cols = append(sq.esubquery.Cols, inner)

	// Build a new column reference to represent the result column.
	rc = newResultColumn(expr, sq)
	sq.resultColumns = append(sq.resultColumns, rc)

	return rc, len(sq.resultColumns) - 1, nil
}
930851
func (del *Delete) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
	if del.QueryTimeout != 0 {
		cancel := vcursor.SetContextTimeout(time.Duration(del.QueryTimeout) * time.Millisecond)
		defer cancel()
	}

	switch del.Opcode {
	case DeleteUnsharded:
		return del.execDeleteUnsharded(vcursor, bindVars)
	case DeleteEqual:
		return del.execDeleteEqual(vcursor, bindVars)
	case DeleteScatter:
		return del.execDeleteByDestination(vcursor, bindVars, key.DestinationAllShards{})
	case DeleteByDestination:
		return del.execDeleteByDestination(vcursor, bindVars, del.TargetDestination)
	default:
		// Unreachable.
		return nil, fmt.Errorf("unsupported opcode: %v", del)
	}
}
945430
func (statement *Statement) Select(str string) *Statement {
	statement.selectStr = str
	return statement
}
805453
func (c *Connection) Select(q *Query) (*SelectResponse, error) {
	resp, err := c.CustomSelect(q, "select")
	return resp, err
}
596683
func (vf *vindexFunc) PushSelect(expr *sqlparser.AliasedExpr, _ builder) (rc *resultColumn, colnum int, err error) {
	// Catch the case where no where clause was specified. If so, the opcode
	// won't be set.
	if vf.eVindexFunc.Opcode == engine.VindexNone {
		return nil, 0, errors.New("unsupported: where clause for vindex function must be of the form id = <val> (where clause missing)")
	}
	col, ok := expr.Expr.(*sqlparser.ColName)
	if !ok {
		return nil, 0, errors.New("unsupported: expression on results of a vindex function")
	}
	rc = newResultColumn(expr, vf)
	vf.resultColumns = append(vf.resultColumns, rc)
	vf.eVindexFunc.Fields = append(vf.eVindexFunc.Fields, &querypb.Field{
		Name: rc.alias.String(),
		Type: querypb.Type_VARBINARY,
	})
	vf.eVindexFunc.Cols = append(vf.eVindexFunc.Cols, col.Metadata.(*column).colnum)
	return rc, len(vf.resultColumns) - 1, nil
}