// Select is a convenience function for creating iterator and calling Select.
//
// DEPRECATED use Queryx.Select or Queryx.SelectRelease.
512477
func Select(dest interface{}, q *gocql.Query) error {
	return Iter(q).Select(dest)
}
920887
func (t *Transaction) Select(dest interface{}, query string, args ...interface{}) error {
	return hookedselect(t.dbmap, t, dest, query, args...)
}
1142026
func (aia *AIA) Select(tx *sql.Tx) error {
	row := tx.QueryRow(`SELECT url FROM aia WHERE ski=?`, aia.SKI)
	err := row.Scan(&aia.URL)
	if err != nil {
		return err
	}

	return nil
}
1153285
func (s *Statement) Select(str string) *Statement {
	s.selectStr = str
	return s
}
942327
func (session *Session) Select(str string) *Session {
	session.statement.Select(str)
	return session
}
352613
func (s *AlertsService) Select(k RRSetKey) ([]ProbeAlertDataDTO, error) {
	// TODO: Sane Configuration for timeouts / retries
	maxerrs := 5
	waittime := 5 * time.Second

	// init accumulators
	as := []ProbeAlertDataDTO{}
	offset := 0
	errcnt := 0

	for {
		reqAlerts, ri, res, err := s.SelectWithOffset(k, offset)
		if err != nil {
			if res != nil && res.StatusCode >= 500 {
				errcnt = errcnt + 1
				if errcnt < maxerrs {
					time.Sleep(waittime)
					continue
				}
			}
			return as, err
		}

		log.Printf("ResultInfo: %+v\n", ri)
		for _, a := range reqAlerts {
			as = append(as, a)
		}
		if ri.ReturnedCount+ri.Offset >= ri.TotalCount {
			return as, nil
		}
		offset = ri.ReturnedCount + ri.Offset
		continue
	}
}
850731
func (t *Array) Select(pos int) Type {
	if len(t.static) > pos {
		return t.static[pos]
	}
	if t.dynamic != nil {
		return t.dynamic
	}
	return nil
}
1153691
func (s *RRSetsService) Select(k RRSetKey) ([]RRSet, error) {
	// TODO: Sane Configuration for timeouts / retries
	maxerrs := 5
	waittime := 5 * time.Second

	rrsets := []RRSet{}
	errcnt := 0
	offset := 0

	for {
		reqRrsets, ri, res, err := s.SelectWithOffset(k, offset)
		if err != nil {
			if res != nil && res.StatusCode >= 500 {
				errcnt = errcnt + 1
				if errcnt < maxerrs {
					time.Sleep(waittime)
					continue
				}
			}
			return rrsets, err
		}

		log.Printf("ResultInfo: %+v\n", ri)
		for _, rrset := range reqRrsets {
			rrsets = append(rrsets, rrset)
		}
		if ri.ReturnedCount+ri.Offset >= ri.TotalCount {
			return rrsets, nil
		}
		offset = ri.ReturnedCount + ri.Offset
		continue
	}
}
1040178
func (b *AnnealingEpsilonGreedy) Select() int {
	if rand.Float64() > b.Epsilon() {
		// Select the maximal value from values.
		max := -1.0
		idx := -1

		// Find the index of the maximal value.
		for i, val := range b.values {
			if val > max {
				max = val
				idx = i
			}
		}

		return idx
	}

	// Otherwise return any of the values
	return rand.Intn(len(b.values))
}
209181
func (r *LeastConn) Select(pool HostPool, request *http.Request) *UpstreamHost {
	var bestHost *UpstreamHost
	count := 0
	leastConn := int64(math.MaxInt64)
	for _, host := range pool {
		if !host.Available() {
			continue
		}

		if host.Conns < leastConn {
			leastConn = host.Conns
			count = 0
		}

		// Among hosts with same least connections, perform a reservoir
		// sample: https://en.wikipedia.org/wiki/Reservoir_sampling
		if host.Conns == leastConn {
			count++
			if (rand.Int() % count) == 0 {
				bestHost = host
			}
		}
	}
	return bestHost
}
1293451
func (s *sticky) Select(aps []AvailablePlugin, taskID string) (AvailablePlugin, error) {
	if ap, ok := s.plugins[taskID]; ok && ap != nil {
		return ap, nil
	}
	return s.selectPlugin(aps, taskID)
}
907840
func (m *MockQuery) Select(arg0 interface{}) mongo.Query {
	ret := m.ctrl.Call(m, "Select", arg0)
	ret0, _ := ret[0].(mongo.Query)
	return ret0
}
451042
func Select(ctx context.Context, sctx sessionctx.Context, kvReq *kv.Request, fieldTypes []*types.FieldType, fb *statistics.QueryFeedback) (SelectResult, error) {
	// For testing purpose.
	if hook := ctx.Value("CheckSelectRequestHook"); hook != nil {
		hook.(func(*kv.Request))(kvReq)
	}

	if !sctx.GetSessionVars().EnableStreaming {
		kvReq.Streaming = false
	}
	resp := sctx.GetClient().Send(ctx, kvReq, sctx.GetSessionVars().KVVars)
	if resp == nil {
		err := errors.New("client returns nil response")
		return nil, err
	}

	// kvReq.MemTracker is used to trace and control memory usage in DistSQL layer;
	// for streamResult, since it is a pipeline which has no buffer, it's not necessary to trace it;
	// for selectResult, we just use the kvReq.MemTracker prepared for co-processor
	// instead of creating a new one for simplification.
	if kvReq.Streaming {
		return &streamResult{
			resp:       resp,
			rowLen:     len(fieldTypes),
			fieldTypes: fieldTypes,
			ctx:        sctx,
			feedback:   fb,
		}, nil
	}

	label := metrics.LblGeneral
	if sctx.GetSessionVars().InRestrictedSQL {
		label = metrics.LblInternal
	}
	return &selectResult{
		label:      "dag",
		resp:       resp,
		results:    make(chan resultWithErr, kvReq.Concurrency),
		closed:     make(chan struct{}),
		rowLen:     len(fieldTypes),
		fieldTypes: fieldTypes,
		ctx:        sctx,
		feedback:   fb,
		sqlType:    label,
		memTracker: kvReq.MemTracker,
	}, nil
}
945430
func (statement *Statement) Select(str string) *Statement {
	statement.selectStr = str
	return statement
}
916513
func (q Query) SelectIndexedT(selectorFn interface{}) Query {
	selectGenericFunc, err := newGenericFunc(
		"SelectIndexedT", "selectorFn", selectorFn,
		simpleParamValidator(newElemTypeSlice(new(int), new(genericType)), newElemTypeSlice(new(genericType))),
	)
	if err != nil {
		panic(err)
	}

	selectorFunc := func(index int, item interface{}) interface{} {
		return selectGenericFunc.Call(index, item)
	}

	return q.SelectIndexed(selectorFunc)
}
1219403
func (engine *Engine) Select(str string) *Session {
	session := engine.NewSession()
	session.isAutoClose = true
	return session.Select(str)
}
760413
func (t *Table) Select(columns ...string) (stmt string, names []string) {
	if len(columns) == 0 {
		return t.sel.stmt, t.sel.names
	}

	return qb.Select(t.metadata.Name).
		Columns(columns...).
		Where(t.primaryKeyCmp[0:len(t.metadata.PartKey)]...).
		ToCql()
}