Tarantool development patches archive
 help / color / mirror / Atom feed
From: "n.pettik" <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Georgy Kirichenko <georgy@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH] Return valid lua error for func creation error
Date: Fri, 2 Nov 2018 16:46:36 +0300	[thread overview]
Message-ID: <44B7E08E-B5DA-40FF-8FDF-1D7B196CB2C2@tarantool.org> (raw)
In-Reply-To: <c1c80fe6983ef992a1b066c7a2180680f0a0e572.1541158162.git.georgy@tarantool.org>

Thanks a lot for investigating this bug.

Patch is OK, only several very minor comments concerning its look.

Usually SQL-related patches come with ‘sql:’ prefix for commit subject.

> On 2 Nov 2018, at 14:30, Georgy Kirichenko <georgy@tarantool.org> wrote:
> 
> Return valid lua error if something fail while sql function creation.

Typo: if something fails during...

You forgot to add 'Closes #xxxx’ sign to commit message.

> ---
> https://github.com/tarantool/tarantool/issues/3724
> https://github.com/tarantool/tarantool/tree/g.kirichenko/gh-3724-return-error-from-func-creation
> 
> src/box/lua/lua_sql.c           |  3 +++
> test/sql/func-recreate.result   | 36 +++++++++++++++++++++++++++++++++
> test/sql/func-recreate.test.lua | 17 ++++++++++++++++
> 3 files changed, 56 insertions(+)
> create mode 100644 test/sql/func-recreate.result
> create mode 100644 test/sql/func-recreate.test.lua
> 
> diff --git a/src/box/lua/lua_sql.c b/src/box/lua/lua_sql.c
> index 9d78679fb..100f53b01 100644
> --- a/src/box/lua/lua_sql.c
> +++ b/src/box/lua/lua_sql.c
> @@ -193,6 +193,9 @@ int lbox_sql_create_function(struct lua_State *L)
> 				  NULL, NULL, lua_sql_destroy);
> 
> 	free(normalized_name);
> +	if (rc != 0) {
> +		return luaL_error(L, sqlite3ErrStr(rc));
> +	}

We don’t put brackets in case if-body contains 1 line:

diff --git a/src/box/lua/lua_sql.c b/src/box/lua/lua_sql.c
index 100f53b01..bcf2ea0fa 100644
--- a/src/box/lua/lua_sql.c
+++ b/src/box/lua/lua_sql.c
@@ -193,9 +193,8 @@ int lbox_sql_create_function(struct lua_State *L)
                                  NULL, NULL, lua_sql_destroy);
 
        free(normalized_name);
-       if (rc != 0) {
+       if (rc != 0)
                return luaL_error(L, sqlite3ErrStr(rc));
-       }
-       return rc;
+       return 0;
 }
 

> diff --git a/test/sql/func-recreate.test.lua b/test/sql/func-recreate.test.lua

We also add for regression tests number of issue to its name:

test/sql/gh-3724-func-recreate.test.lua

  reply	other threads:[~2018-11-02 13:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-02 11:30 [tarantool-patches] " Georgy Kirichenko
2018-11-02 13:46 ` n.pettik [this message]
2018-11-13 11:47 ` [tarantool-patches] " 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=44B7E08E-B5DA-40FF-8FDF-1D7B196CB2C2@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=georgy@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH] Return valid lua error for func creation error' \
    /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