Tarantool development patches archive
 help / color / mirror / Atom feed
From: "n.pettik" <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Alex Khatskevich <avkhatskevich@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH v2] sql: fix decode analyze sample
Date: Tue, 19 Jun 2018 16:55:23 +0300	[thread overview]
Message-ID: <B3ED2159-1411-462D-A71F-A208BEED6148@tarantool.org> (raw)
In-Reply-To: <82a5964f-ccf6-1d29-78e0-186fa1ebcac0@tarantool.org>

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.

  reply	other threads:[~2018-06-19 13:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-01 16:50 [tarantool-patches] " AKhatskevich
2018-06-19  1:12 ` [tarantool-patches] " n.pettik
2018-06-19  8:18   ` Alex Khatskevich
2018-06-19 13:55     ` n.pettik [this message]
2018-06-19 14:59       ` Alex Khatskevich
2018-06-29 15:05         ` n.pettik
2018-06-29 15:09           ` Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B3ED2159-1411-462D-A71F-A208BEED6148@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=avkhatskevich@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v2] sql: fix decode analyze sample' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox