[Tarantool-patches] [PATCH v4 19/53] sql: introduce mem_compare()
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Tue Mar 30 02:03:03 MSK 2021
Thanks for the patch!
I don't understand. Why are there still sqlMemCompare(), sqlBlobCompare()
if you also have mem_compare(), compare_blobs(), compare_numbers()?
> diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c
> index 6120939d8..8119644ed 100644
> --- a/src/box/sql/mem.c
> +++ b/src/box/sql/mem.c
> @@ -556,6 +556,247 @@ mem_arithmetic(const struct Mem *left, const struct Mem *right,
> return 0;
> }
>
> +static int
> +compare_blobs(const struct Mem *left, const struct Mem *right, int *result)> +{
> + int nl = left->n;
> + int nr = right->n;
> + int minlen = MIN(nl, nr);
> +
> + /*
> + * It is possible to have a Blob value that has some non-zero content
> + * followed by zero content. But that only comes up for Blobs formed
> + * by the OP_MakeRecord opcode, and such Blobs never get passed into
> + * mem_compare().
> + */
> + assert((left->flags & MEM_Zero) == 0 || nl == 0);
> + assert((right->flags & MEM_Zero) == 0 || nr == 0);
> +
> + if (left->flags & right->flags & MEM_Zero) {
Please, use explicit != 0, in the other places below too.
More information about the Tarantool-patches
mailing list