[tarantool-patches] Re: [PATCH v2] sql: fix decode analyze sample

n.pettik korablev at tarantool.org
Tue Jun 19 16:55:23 MSK 2018


As far as I understand, there is only one call of sql_stat4_column().
You may make this function static and move to where.c,
if you want so.

> index f408b7701..017109359 100644
> --- a/src/box/sql/vdbemem.c
> +++ b/src/box/sql/vdbemem.c
> @@ -1588,56 +1588,31 @@ sqlite3Stat4ValueFromExpr(Parse * pParse,    /* Parse context */
>      return stat4ValueFromExpr(pParse, pExpr, affinity, 0, ppVal);
>  }
> 
> +    assert(col_num >= 0);
> +    /* Write result into this Mem object. */
> +    struct Mem *mem = *res;
> +    /* Typecast byte array. */

I guess, it is obsolete comment.

> +    const char *a = record;
> +    assert(mp_typeof(a[0]) == MP_ARRAY);
> +    int col_cnt = mp_decode_array(&a);

mp_decode_array returns uint32_t, so lets use this type.

> +    assert(col_cnt > col_num);
> +    for (int i = 0; i < col_num; i++)
> +        mp_next(&a);
> +    if (mem == NULL) {
> +        mem = sqlite3ValueNew(db);
> +        *res = mem;
> +        if (mem == NULL) {
> +            diag_set(OutOfMemory, sizeof(Mem), "sqlite3ValueNew”,

sizeof(struct Mem) or *mem

The rest seems OK to me.





More information about the Tarantool-patches mailing list