// Begin positions the iterator at the beginning of the index.
433201
func (s *ShapeIndexIterator) Begin() {
	if !s.index.IsFresh() {
		s.index.maybeApplyUpdates()
	}
	s.position = 0
	s.refresh()
}
43323
func (this *Model) Begin() *xorm.Session {
	ss, _ := this.transSession()
	if ss != nil {
		ss.Close()
	}
	ss = this.DB.NewSession()
	err := ss.Begin()
	if err != nil {
		this.Context.Object().Echo().Logger().Error(err)
	}
	this.Context.Set(`webx:transSession`, ss)
	return ss
}
684909
func (c *TxnController) Begin() revel.Result {

	txn := gormdb.DB.Begin()
	if txn.Error != nil {
		c.Log.Panic("Transaction begine error", "error", txn.Error)
	}

	c.Txn = txn
	return nil
}
1128577
func (q *Qbs) Begin() error {
	if q.tx != nil {
		panic("cannot start nested transaction")
	}
	tx, err := db.Begin()
	q.tx = tx
	q.txStmtMap = make(map[string]*sql.Stmt)
	return err
}
287768
func (dec *Decoder) begin() (err error) {
	inBracket := false
	valBracket := ""
	bracketClosed := false
	lastPos := 0
	tmp := dec.field

	// parse path
	for i, char := range tmp {
		if char == '[' && inBracket == false {
			// found an opening bracket
			bracketClosed = false
			inBracket = true
			dec.field = tmp[lastPos:i]
			lastPos = i + 1
			/*
				if err = dec.walk(); err != nil {
					return
				}
			*/
			continue
		} else if inBracket {
			// it is inside of bracket, so get its value
			if char == ']' {
				/*
					nextChar := tmp[i+1:]
					if nextChar != "" {
						t := nextChar[:1]
						if t != "[" && t != "." {
							valBracket += string(char)
							continue
						}
					}
				*/
				// found an closing bracket, so it will be recently close, so put as true the bracketClosed
				// and put as false inBracket and pass the value of bracket to dec.key
				inBracket = false
				bracketClosed = true
				dec.bracket = valBracket
				lastPos = i + 1
				if err = dec.walk(); err != nil {
					return
				}
				valBracket = ""
			} else {
				// still inside the bracket, so follow getting its value
				valBracket += string(char)
			}
			continue
		} else if !inBracket {
			// not found any bracket, so try found a field
			if char == '.' {
				// found a field, we need to know if the field is next of a closing bracket,
				// for example: [0].Field
				if bracketClosed {
					bracketClosed = false
					lastPos = i + 1
					continue
				}
				// found a field, but is not next of a closing bracket, for example: Field1.Field2
				dec.field = tmp[lastPos:i]
				//dec.field = tmp[:i]
				lastPos = i + 1
				if err = dec.walk(); err != nil {
					return
				}
			}
			continue
		}
	}
	// last field of path
	dec.field = tmp[lastPos:]

	return dec.end()
}
1209442
func (te *TxEngine) Begin(ctx context.Context, options *querypb.ExecuteOptions) (int64, string, error) {
	span, ctx := trace.NewSpan(ctx, "TxEngine.Begin")
	defer span.Finish()
	te.stateLock.Lock()

	canOpenTransactions := te.state == AcceptingReadOnly || te.state == AcceptingReadAndWrite
	if !canOpenTransactions {
		// We are not in a state where we can start new transactions. Abort.
		te.stateLock.Unlock()
		return 0, "", vterrors.Errorf(vtrpc.Code_UNAVAILABLE, "tx engine can't accept new transactions in state %v", te.state)
	}

	isWriteTransaction := options == nil || options.TransactionIsolation != querypb.ExecuteOptions_CONSISTENT_SNAPSHOT_READ_ONLY
	if te.state == AcceptingReadOnly && isWriteTransaction {
		te.stateLock.Unlock()
		return 0, "", vterrors.Errorf(vtrpc.Code_UNAVAILABLE, "tx engine can only accept read-only transactions in current state")
	}

	// By Add() to beginRequests, we block others from initiating state
	// changes until we have finished adding this transaction
	te.beginRequests.Add(1)
	te.stateLock.Unlock()

	defer te.beginRequests.Done()
	return te.txPool.Begin(ctx, options)
}
516642
func (s *SigPool) Start() error {
	if !atomic.CompareAndSwapUint32(&s.started, 0, 1) {
		return nil
	}

	for i := 0; i < s.numWorkers; i++ {
		s.wg.Add(1)
		go s.poolWorker()
	}

	return nil
}
844413
func (m *collection) Start() error {
	if !m.options.ReadOnly {
		// Kick off merger and persister only when not in Read-Only mode
		go m.runMerger()
		go m.runPersister()
	}
	return nil
}
955240
func (client *QueryClient) Begin(clientFoundRows bool) error {
	if client.transactionID != 0 {
		return errors.New("already in transaction")
	}
	var options *querypb.ExecuteOptions
	if clientFoundRows {
		options = &querypb.ExecuteOptions{ClientFoundRows: clientFoundRows}
	}
	transactionID, err := client.server.Begin(client.ctx, &client.target, options)
	if err != nil {
		return err
	}
	client.transactionID = transactionID
	return nil
}
1000166
func (itc *internalTabletConn) Begin(ctx context.Context, target *querypb.Target, options *querypb.ExecuteOptions) (int64, error) {
	transactionID, err := itc.tablet.qsc.QueryService().Begin(ctx, target, options)
	if err != nil {
		return 0, tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err))
	}
	return transactionID, nil
}
70870
func (c *Transactional) Begin() revel.Result {
	txn, err := Db.Begin()
	if err != nil {
		panic(err)
	}
	c.Txn = txn
	return nil
}
1309652
func (adapter *Adapter) Begin() (grimoire.Adapter, error) {
	var tx *sql.Tx
	var savepoint int
	var err error

	if adapter.Tx != nil {
		tx = adapter.Tx
		savepoint = adapter.savepoint + 1
		_, _, err = adapter.Exec("SAVEPOINT s"+strconv.Itoa(savepoint)+";", []interface{}{})
	} else {
		tx, err = adapter.DB.Begin()
	}

	return &Adapter{
		Config:    adapter.Config,
		Tx:        tx,
		savepoint: savepoint,
	}, err
}
789016
func (this *Manidator) Begin(ctx context.Context) {
	this.wg.Add(1)
	this.init()

	go func() {
		defer this.wg.Done()

		for {
			linesPrinted := this.printLines()

			select {
			case <-time.After(this.Interval):
				this.eraseLinesN(linesPrinted)
			case <-this.Done():
				// all Dators finished
				return
			case <-this.cancel:
				// manidator was stopped
				return
			case <-ctx.Done():
				// app was stopped
				return
			}
		}
	}()
}
958813
func (c *CrateDriver) Begin() (driver.Tx, error) {
	err := errors.New("Transactions are not supported by this driver.")
	return nil, err
}
171094
func (r *DB) Begin() (err error) {
	if r.inTx > 0 {
		_, err = r.Exec(fmt.Sprintf("SAVEPOINT sp_%d", r.inTx))
	}
	if r.inTx == 0 {
		if r.ctx == nil {
			r.Log(func() {
				r.Tx, err = r.DB.Beginx()
			}, "BEGIN;")
		} else {
			r.Log(func() {
				r.Tx, err = r.DB.BeginTxx(r.ctx, r.TxOpts)
			}, "BEGIN; -- with context")
		}
	}
	if err != nil {
		return errors.WithStack(err)
	}

	r.inTx++
	return nil
}
218805
func (w *Window) begin() {
	if currWin != w {
		w.window.MakeContextCurrent()
		currWin = w
	}
}
44163
func (p *Parser) Start() {
  go func() {
    defer close(p.Done)
    expressions := make([]Sexp, 0, SliceDefaultCap)
    for {
        expr, err := p.parseExpression(0)
        if err != nil || expr == SexpEnd {
            if err == ParserHaltRequested {
                return
            }
            err = p.getMoreInput(expressions, err) // SexpEnd means we need more input
            if err == ParserHaltRequested {
                return
            }
            expressions = make([]Sexp, 0, SliceDefaultCap)
        } else {
            expressions = append(expressions, expr)
        }
    }
  }()
}