func (t *MemoryTable) AddRecord(ctx context.Context, r []types.Datum) (recordID int64, err error) {
	if t.pkHandleCol != nil {
		recordID, err = r[t.pkHandleCol.Offset].ToInt64(ctx.GetSessionVars().StmtCtx)
		if err != nil {
			return 0, errors.Trace(err)
		}
	} else {
		recordID, err = t.alloc.Alloc(t.ID)
		if err != nil {
			return 0, errors.Trace(err)
		}
	}
	item := &itemPair{
		handle: itemKey(recordID),
		data:   r,
	}
	t.mu.Lock()
	defer t.mu.Unlock()
	if t.tree.Get(itemKey(recordID)) != nil {
		return 0, kv.ErrKeyExists
	}
	t.tree.ReplaceOrInsert(item)
	return
}
// AddRecord implements table.Table AddRecord interface.
AddRecord implements table.Table AddRecord interface.
// AddRecord implements table . Table AddRecord interface .
func (t *MemoryTable) AddRecord(ctx context.Context, r []types.Datum) (recordID int64, err error) {
	if t.pkHandleCol != nil {
		recordID, err = r[t.pkHandleCol.Offset].ToInt64(ctx.GetSessionVars().StmtCtx)
		if err != nil {
			return 0, errors.Trace(err)
		}
	} else {
		recordID, err = t.alloc.Alloc(t.ID)
		if err != nil {
			return 0, errors.Trace(err)
		}
	}
	item := &itemPair{
		handle: itemKey(recordID),
		data:   r,
	}
	t.mu.Lock()
	defer t.mu.Unlock()
	if t.tree.Get(itemKey(recordID)) != nil {
		return 0, kv.ErrKeyExists
	}
	t.tree.ReplaceOrInsert(item)
	return
}
func ( t * MemoryTable ) AddRecord ( ctx context . Context , r [ ] types . Datum ) ( recordID int64 , err error ) { if t . pkHandleCol != nil { recordID , err = r [ t . pkHandleCol . Offset ] . ToInt64 ( ctx . GetSessionVars ( ) . StmtCtx ) if err != nil { return 0 , errors . Trace ( err ) } } else { recordID , err = t . alloc . Alloc ( t . ID ) if err != nil { return 0 , errors . Trace ( err ) } } item := & itemPair { handle : itemKey ( recordID ) , data : r , } t . mu . Lock ( ) defer t . mu . Unlock ( ) if t . tree . Get ( itemKey ( recordID ) ) != nil { return 0 , kv . ErrKeyExists } t . tree . ReplaceOrInsert ( item ) return }
AddRecord implements table.Table AddRecord interface.
AddRecord implements table . Table AddRecord interface .