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

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Tue Apr 13 02:36:45 MSK 2021


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?


More information about the Tarantool-patches mailing list