// getOneRow gets one result row from dirty table or child.
174159
func (us *UnionScanExec) getOneRow(ctx context.Context) ([]types.Datum, error) {
	for {
		snapshotRow, err := us.getSnapshotRow(ctx)
		if err != nil {
			return nil, err
		}
		addedRow := us.getAddedRow()
		var row []types.Datum
		var isSnapshotRow bool
		if addedRow == nil {
			row = snapshotRow
			isSnapshotRow = true
		} else if snapshotRow == nil {
			row = addedRow
		} else {
			isSnapshotRow, err = us.shouldPickFirstRow(snapshotRow, addedRow)
			if err != nil {
				return nil, err
			}
			if isSnapshotRow {
				row = snapshotRow
			} else {
				row = addedRow
			}
		}
		if row == nil {
			return nil, nil
		}

		if isSnapshotRow {
			us.cursor4SnapshotRows++
		} else {
			us.cursor4AddRows++
		}
		return row, nil
	}
}
655838
func (fs *FileSorter) fetchNextRow(index int) (*comparableRow, error) {
	var (
		err  error
		n    int
		head = make([]byte, 8)
		dcod = make([]types.Datum, 0, fs.keySize+fs.valSize+1)
	)
	n, err = fs.fds[index].Read(head)
	if err == io.EOF {
		return nil, nil
	}
	if err != nil {
		return nil, errors.Trace(err)
	}
	if n != 8 {
		return nil, errors.New("incorrect header")
	}
	rowSize := int(binary.BigEndian.Uint64(head))

	rowBytes := make([]byte, rowSize)

	n, err = fs.fds[index].Read(rowBytes)
	if err != nil {
		return nil, errors.Trace(err)
	}
	if n != rowSize {
		return nil, errors.New("incorrect row")
	}

	dcod, err = codec.Decode(rowBytes, fs.keySize+fs.valSize+1)
	if err != nil {
		return nil, errors.Trace(err)
	}

	return &comparableRow{
		key:    dcod[:fs.keySize],
		val:    dcod[fs.keySize : fs.keySize+fs.valSize],
		handle: dcod[fs.keySize+fs.valSize:][0].GetInt64(),
	}, nil
}
3558
func (d DotSql) QueryRow(db QueryRower, name string, args ...interface{}) (*sql.Row, error) {
	query, err := d.lookupQuery(name)
	if err != nil {
		return nil, err
	}

	return db.QueryRow(query, args...), nil
}
1122417
func getBoundValueForComponent(r table.Row, bs []string) *table.Cell {
	var cs []*table.Cell
	for _, b := range bs {
		if v, ok := r[b]; ok {
			cs = append(cs, v)
		}
	}
	if len(cs) == 1 || len(cs) == 2 && reflect.DeepEqual(cs[0], cs[1]) {
		return cs[0]
	}
	return nil
}
1191139
func (e *Encoder) GetRow(v interface{}) ([]string, error) {
	if reflect.TypeOf(v).Kind() != reflect.Struct {
		return nil, StructRequiredError{reflect.TypeOf(v).Kind()}
	}
	// 2nd parm is only used for recursive calls.
	cols, _ := e.marshalStruct(v, false)
	return cols, nil
}
296374
func (ev *ChangeResp) GetValue(val proto.Message) (err error) {
	return ev.CurrVal.GetValue(val)
}
417531
func (v *boolVector) Get(colID uint64) (uint64, bool, error) {
	rows := v.f.rows(0, filterColumn(colID))
	if len(rows) > 1 {
		return 0, false, errors.New("found multiple row values for column")
	} else if len(rows) == 1 {
		switch rows[0] {
		case falseRowID, trueRowID:
			return rows[0], true, nil
		default:
			return 0, false, errors.New("found non-boolean value")
		}
	}
	return 0, false, nil
}
395441
func (t *Table) Row(i int) (Row, bool) {
	t.mu.RLock()
	defer t.mu.RUnlock()
	if i < 0 || i >= len(t.Data) {
		return nil, false
	}
	return t.Data[i], true
}
1320290
func (nuageTable *NuageTable) InsertRow(ovs *libovsdb.OvsdbClient, row NuageTableRow) error {

	glog.V(2).Infof("Trying to insert (%+v) into the Nuage Table (%s)", row, nuageTable.TableName)

	ovsdbRow := make(map[string]interface{})
	err := row.CreateOVSDBRow(ovsdbRow)
	if err != nil {
		glog.Errorf("Unable to create the OVSDB row %v", err)
		return err
	}

	insertOp := libovsdb.Operation{
		Op:       "insert",
		Table:    nuageTable.TableName,
		Row:      ovsdbRow,
		UUIDName: "gopher",
	}

	operations := []libovsdb.Operation{insertOp}
	reply, err := ovs.Transact(OvsDBName, operations...)

	glog.V(2).Infof("reply : (%+v) err : (%+v)", reply, err)

	if err != nil || len(reply) != 1 || reply[0].Error != "" {
		errStr := fmt.Errorf("Problem inserting row in the Nuage table row = "+
			" (%+v) ovsdbrow (%+v) err (%+v) reply (%+v)", row, ovsdbRow, err, reply)
		glog.Error(errStr)
		return (errStr)
	}

	glog.V(2).Info("Insertion into Nuage VM Table succeeded with UUID %s", reply[0].UUID)

	return nil
}
747548
func (b *BlockData) GetRows(tableName string) (types.EventDataTable, error) {
	if table, ok := b.Data.Tables[tableName]; ok {
		return table, nil
	}
	return nil, fmt.Errorf("GetRows: tableName does not exists as a table in data structure: %s ", tableName)
}
543291
func (f *File) GetRowVisible(sheet string, row int) (bool, error) {
	if row < 1 {
		return false, newInvalidRowNumberError(row)
	}

	xlsx, err := f.workSheetReader(sheet)
	if err != nil {
		return false, err
	}
	if row > len(xlsx.SheetData.Row) {
		return false, nil
	}
	return !xlsx.SheetData.Row[row-1].Hidden, nil
}
192643
func (list *List) GetValue() interface{} {
	var values []interface{}
	for _, val := range list.values {
		values = append(values, val.GetValue())
	}
	return values
}
556853
func (o *rawSet) QueryRow(containers ...interface{}) error {
	var (
		refs  = make([]interface{}, 0, len(containers))
		sInds []reflect.Value
		eTyps []reflect.Type
		sMi   *modelInfo
	)
	structMode := false
	for _, container := range containers {
		val := reflect.ValueOf(container)
		ind := reflect.Indirect(val)

		if val.Kind() != reflect.Ptr {
			panic(fmt.Errorf("<RawSeter.QueryRow> all args must be use ptr"))
		}

		etyp := ind.Type()
		typ := etyp
		if typ.Kind() == reflect.Ptr {
			typ = typ.Elem()
		}

		sInds = append(sInds, ind)
		eTyps = append(eTyps, etyp)

		if typ.Kind() == reflect.Struct && typ.String() != "time.Time" {
			if len(containers) > 1 {
				panic(fmt.Errorf("<RawSeter.QueryRow> now support one struct only. see #384"))
			}

			structMode = true
			fn := getFullName(typ)
			if mi, ok := modelCache.getByFN(fn); ok {
				sMi = mi
			}
		} else {
			var ref interface{}
			refs = append(refs, &ref)
		}
	}

	query := o.query
	o.orm.alias.DbBaser.ReplaceMarks(&query)

	args := getFlatParams(nil, o.args, o.orm.alias.TZ)
	rows, err := o.orm.db.Query(query, args...)
	if err != nil {
		if err == sql.ErrNoRows {
			return ErrNoRows
		}
		return err
	}

	defer rows.Close()

	if rows.Next() {
		if structMode {
			columns, err := rows.Columns()
			if err != nil {
				return err
			}

			columnsMp := make(map[string]interface{}, len(columns))

			refs = make([]interface{}, 0, len(columns))
			for _, col := range columns {
				var ref interface{}
				columnsMp[col] = &ref
				refs = append(refs, &ref)
			}

			if err := rows.Scan(refs...); err != nil {
				return err
			}

			ind := sInds[0]

			if ind.Kind() == reflect.Ptr {
				if ind.IsNil() || !ind.IsValid() {
					ind.Set(reflect.New(eTyps[0].Elem()))
				}
				ind = ind.Elem()
			}

			if sMi != nil {
				for _, col := range columns {
					if fi := sMi.fields.GetByColumn(col); fi != nil {
						value := reflect.ValueOf(columnsMp[col]).Elem().Interface()
						o.setFieldValue(ind.FieldByIndex([]int{fi.fieldIndex}), value)
					}
				}
			} else {
				for i := 0; i < ind.NumField(); i++ {
					f := ind.Field(i)
					fe := ind.Type().Field(i)

					var attrs map[string]bool
					var tags map[string]string
					parseStructTag(fe.Tag.Get("orm"), &attrs, &tags)
					var col string
					if col = tags["column"]; len(col) == 0 {
						col = snakeString(fe.Name)
					}
					if v, ok := columnsMp[col]; ok {
						value := reflect.ValueOf(v).Elem().Interface()
						o.setFieldValue(f, value)
					}
				}
			}

		} else {
			if err := rows.Scan(refs...); err != nil {
				return err
			}

			nInds := make([]reflect.Value, len(sInds))
			o.loopSetRefs(refs, sInds, &nInds, eTyps, true)
			for i, sInd := range sInds {
				nInd := nInds[i]
				sInd.Set(nInd)
			}
		}

	} else {
		return ErrNoRows
	}

	return nil
}
761494
func (l *State) RawGetValue(index int, p interface{}) {
	t := l.indexToValue(index).(*table)
	l.apiPush(t.at(p))
}
854430
func (nuageTable *NuageTable) UpdateRow(ovs *libovsdb.OvsdbClient, ovsdbRow map[string]interface{}, condition []string) error {

	glog.V(2).Infof("Trying to update the row (%+v) the Nuage Table (%s)", ovsdbRow, nuageTable.TableName)

	ovsdbCondition := libovsdb.NewCondition(condition[0], condition[1], condition[2])
	updateOp := libovsdb.Operation{
		Op:    "update",
		Table: nuageTable.TableName,
		Row:   ovsdbRow,
		Where: []interface{}{ovsdbCondition},
	}

	operations := []libovsdb.Operation{updateOp}
	reply, err := ovs.Transact(OvsDBName, operations...)

	glog.V(2).Infof("reply : (%+v) err : (%+v)", reply, err)

	if err != nil || len(reply) != 1 || reply[0].Error != "" {
		glog.Errorf("Failed to update row in the Nuage table %s %v", nuageTable.TableName, err)
		return fmt.Errorf("Failed to update row in the Nuage table %s %v", nuageTable.TableName, err)
	}

	if reply[0].Count != 1 {
		glog.Errorf("Failed to update the Nuage Table entry for table %s condition %v", nuageTable.TableName, condition)
		return fmt.Errorf("Failed to update the Nuage Table entry for table %s condition %v",
			nuageTable.TableName, condition)
	}

	return nil
}
549288
func (idx *Index) GetRowCount(sc *stmtctx.StatementContext, indexRanges []*ranger.Range, modifyCount int64) (float64, error) {
	totalCount := float64(0)
	isSingleCol := len(idx.Info.Columns) == 1
	for _, indexRange := range indexRanges {
		lb, err := codec.EncodeKey(sc, nil, indexRange.LowVal...)
		if err != nil {
			return 0, err
		}
		rb, err := codec.EncodeKey(sc, nil, indexRange.HighVal...)
		if err != nil {
			return 0, err
		}
		fullLen := len(indexRange.LowVal) == len(indexRange.HighVal) && len(indexRange.LowVal) == len(idx.Info.Columns)
		if bytes.Equal(lb, rb) {
			if indexRange.LowExclude || indexRange.HighExclude {
				continue
			}
			if fullLen {
				count, err := idx.equalRowCount(sc, lb, modifyCount)
				if err != nil {
					return 0, err
				}
				totalCount += count
				continue
			}
		}
		if indexRange.LowExclude {
			lb = kv.Key(lb).PrefixNext()
		}
		if !indexRange.HighExclude {
			rb = kv.Key(rb).PrefixNext()
		}
		l := types.NewBytesDatum(lb)
		r := types.NewBytesDatum(rb)
		totalCount += idx.BetweenRowCount(l, r)
		lowIsNull := bytes.Equal(lb, nullKeyBytes)
		if (idx.outOfRange(l) && !(isSingleCol && lowIsNull)) || idx.outOfRange(r) {
			totalCount += float64(modifyCount) / outOfRangeBetweenRate
		}
		if isSingleCol && lowIsNull {
			totalCount += float64(idx.NullCount)
		}
	}
	if totalCount > idx.TotalRowCount() {
		totalCount = idx.TotalRowCount()
	}
	return totalCount, nil
}
374883
func (obj *GenericObject) GetParent(ctx context.Context) (*GenericObject, error) {
	result := &struct {
		Return *ObjectInterface	`json:"qReturn"`
	} {}
	err := obj.rpc(ctx, "GetParent", result)
	if err != nil {
		return nil, err
	}
	return &GenericObject{obj.session.getRemoteObject(result.Return)}, err 
}