[Tarantool-patches] [PATCH v5 32/52] sql: introduce mem_set_*() for map and array

Mergen Imeev imeevma at tarantool.org
Wed Apr 14 01:08:52 MSK 2021


Thank you for the review! My answer below.

On Tue, Apr 13, 2021 at 01:36:45AM +0200, Vladislav Shpilevoy wrote:
> Thanks for working on this!
> 
> > diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c
> > index 508b1dee3..61849cde7 100644
> > --- a/src/box/sql/mem.c
> > +++ b/src/box/sql/mem.c
> > @@ -520,6 +520,75 @@ mem_set_zerobin(struct Mem *mem, int n)
> >  	mem->field_type = FIELD_TYPE_VARBINARY;
> >  }
> >  
> > +static inline void
> > +set_msgpack_value(struct Mem *mem, char *value, uint32_t size, int alloc_type,
> > +		  enum field_type type)
> > +{
> > +	if (alloc_type == MEM_Ephem || alloc_type == MEM_Static)
> > +		set_bin_const(mem, value, size, alloc_type);
> > +	else
> > +		set_bin_dynamic(mem, value, size, alloc_type);
> > +	mem->flags |= MEM_Subtype;
> > +	mem->subtype = SQL_SUBTYPE_MSGPACK;
> > +	mem->field_type = type;
> 
> Previously field_type wasn't set. Why did you change that?
This is the simplest way I know to make sure that MEM-type and field-type are
compatible.



More information about the Tarantool-patches mailing list