// Close closes the result set. Close is idempotent.
164835
func (r *resultSet) Close() {
	if r == nil {
		return // Nothing to do.
	}
	r.row.Query = nil
	r.cur.Close()
}
1029727
func (b *blockDec) Close() {
	close(b.input)
	close(b.history)
	close(b.result)
}
411688
func (cp *Pool) Close() {
	p := cp.pool()
	if p == nil {
		return
	}
	// We should not hold the lock while calling Close
	// because it waits for connections to be returned.
	p.Close()
	cp.mu.Lock()
	cp.connections = nil
	cp.mu.Unlock()
	cp.dbaPool.Close()
}
1236967
func (iter *Iterx) Close() error {
	err := iter.Iter.Close()
	if iter.err == nil {
		iter.err = err
	}
	return iter.err
}
89513
func (pr *pipeRelay) close() {
	pr.once.Do(func() {
		pr.io.Close()
		pr.ps.Close()
	})
}
785717
func (ics *IterateCloserStruct) Close() error {
	if ics.CloserF != nil {
		return ics.CloserF()
	}
	return nil
}
805796
func (e *HashAggExec) Close() error {
	if e.isUnparallelExec {
		e.childResult = nil
		e.groupSet = nil
		e.partialResultMap = nil
		return e.baseExecutor.Close()
	}
	// `Close` may be called after `Open` without calling `Next` in test.
	if !e.prepared {
		close(e.inputCh)
		for _, ch := range e.partialOutputChs {
			close(ch)
		}
		close(e.finalOutputCh)
	}
	close(e.finishCh)
	for _, ch := range e.partialOutputChs {
		for range ch {
		}
	}
	for range e.finalOutputCh {
	}
	return e.baseExecutor.Close()
}
972982
func (h *BuildHandler) Close() error {
	var result error
	for _, closer := range h.closers {
		err := closer.Close()
		if err != nil {
			result = multierror.Append(result, err)
		}
	}
	return result
}
619480
func (body *Body) Close() error {
	if body.isOpen {
		body.isOpen = false
		body.closeAttempts++
	}
	return nil
}
795183
func (e *SelectionExec) Close() error {
	e.childResult = nil
	e.selected = nil
	return e.baseExecutor.Close()
}
656293
func (tc *TiDBContext) Close() error {
	// close PreparedStatement associated with this connection
	for _, v := range tc.stmts {
		terror.Call(v.Close)
	}

	tc.session.Close()
	return nil
}
435923
func (e *Engine) Close() error {
	e.mu.RLock()
	if e.closing == nil {
		return nil // Already closed
	}

	close(e.closing)
	e.mu.RUnlock()

	// Wait for any other goroutines to finish.
	e.wg.Wait()

	e.mu.Lock()
	defer e.mu.Unlock()
	e.closing = nil

	var ch closeHelper
	ch.Close(e.engine)
	ch.Close(e.wal)
	ch.Close(e.index)
	ch.Close(e.sfile)
	return ch.Done()
}
438619
func (r *Reference) Close() {
	if !r.setClosed() {
		// Already closed
		return
	}

	logger.Debug("Closing reference")

	r.notifyClosing()
	r.wg.Wait()
	r.finalize()
}
111183
func (ns *NsHandle) Close() error {
	if err := syscall.Close(int(*ns)); err != nil {
		return err
	}
	(*ns) = -1
	return nil
}
1238985
func (m *Source) Close() error {
	if m.db != nil {
		err := m.db.Close()
		if err != nil {
			return err
		}
		m.db = nil
	}
	return nil
}
189865
func (c *StandardXMLSearchResult) Close() error {
	if c == nil || c.body == nil {
		return nil
	}
	return c.body.Close()
}
508977
func (c *Client) Close() error {
	if c.db != nil {
		return c.db.Close()
	}
	return nil
}