Tarantool development patches archive
 help / color / mirror / Atom feed
From: "n.pettik" <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Imeev Mergen <imeevma@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH v4 3/8] sql: replace rc with is_aborted status in struct Parse
Date: Tue, 19 Mar 2019 12:54:45 +0300	[thread overview]
Message-ID: <61975B3B-0FDC-4117-88F9-4EB3A6EC247B@tarantool.org> (raw)
In-Reply-To: <20190318152804.GA24675@tarantool.org>

[-- Attachment #1: Type: text/plain, Size: 2748 bytes --]


>>>>> diff --git a/test/sql-tap/check.test.lua b/test/sql-tap/check.test.lua
>>>>> index bab6493..0d8bf15 100755
>>>>> --- a/test/sql-tap/check.test.lua
>>>>> +++ b/test/sql-tap/check.test.lua
>>>>> @@ -516,7 +516,7 @@ test:do_catchsql_test(
>>>>>       );
>>>>>   ]], {
>>>>>       -- <check-5.1>
>>>>> -        1, "Wrong space options (field 5): invalid expression specified (SQL error: bindings are not allowed in DDL)"
>>>>> +        1, "Wrong space options (field 5): invalid expression specified (bindings are not allowed in DDL)"
>>>>>       -- </check-5.1>
>>>>>   })
>>>> 
>>>> Why test results have changed if you provided
>>>> non-functional refactoring?
>>> It become this way because now the error in diag instead of being
>>> only in zErrMsg of struct Parse.
>> 
>> So, then it should be related to the previous patch, I guess.
>> Otherwise, still don’t understand. Or fix commit message,
>> since now it implies that only refactoring was provided.
>> Or, what is better - move functional changes to separate patch.
>> 
> I divided this ptch into two:
> "sql: remove argument pzErrMsg from sqlRunParser()"
> "sql: replace rc with is_aborted status in struct Parse”

Both patches are OK.

>>> index a2937a0..c2e5d6b 100644
>>> --- a/src/box/sql.c
>>> +++ b/src/box/sql.c
>>> @@ -1363,12 +1363,8 @@ sql_checks_resolve_space_def_reference(ExprList *expr_list,
>>> 
>>> 	sql_resolve_self_reference(&parser, def, NC_IsCheck, NULL, expr_list);
>>> 	int rc = 0;
>>> -	if (parser.rc != SQL_OK) {
>>> -		/* Tarantool error may be already set with diag. */
>>> -		if (parser.rc != SQL_TARANTOOL_ERROR)
>>> -			diag_set(ClientError, ER_SQL, parser.zErrMsg);
>>> +	if (parser.is_aborted)
>>> 		rc = -1;
>>> -	}
>>> 	sql_parser_destroy(&parser);
>>> 	return rc;
>> 
>> diff --git a/src/box/sql.c b/src/box/sql.c
>> index c2e5d6bd1..ea71dd101 100644
>> --- a/src/box/sql.c
>> +++ b/src/box/sql.c
>> @@ -1362,9 +1362,6 @@ sql_checks_resolve_space_def_reference(ExprList *expr_list,
>>        parser.parse_only = true;
>> 
>>        sql_resolve_self_reference(&parser, def, NC_IsCheck, NULL, expr_list);
>> -       int rc = 0;
>> -       if (parser.is_aborted)
>> -               rc = -1;
>>        sql_parser_destroy(&parser);
>> -       return rc;
>> +       return parser.is_aborted ? -1 : 0;
>> }
>> 
> I am not sure that this should be applied. I think it isn't right
> to look at field is_aborted of parser after parser destruction.

sql_parser_destroy() doesn’t affect is_abort field. On the other
hand, mb you are right, and using object after destructor is called
may seem strange. Anyway, replace pls ‘if' with ternary operator:
3 lines of code fit into one.


[-- Attachment #2: Type: text/html, Size: 9343 bytes --]

  reply	other threads:[~2019-03-19  9:54 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13 17:03 [tarantool-patches] [PATCH v4 0/8] sql: use diag_set() for errors in SQL imeevma
2019-03-13 17:03 ` [tarantool-patches] [PATCH v4 1/8] sql: rework syntax errors imeevma
2019-03-14 18:24   ` [tarantool-patches] " n.pettik
2019-03-14 18:28     ` Imeev Mergen
2019-03-15 14:09   ` Kirill Yukhin
2019-03-13 17:03 ` [tarantool-patches] [PATCH v4 2/8] sql: set SQL parser errors via diag_set() imeevma
2019-03-14 19:26   ` [tarantool-patches] " n.pettik
2019-03-14 19:36     ` n.pettik
2019-03-18 15:06     ` Mergen Imeev
2019-03-19  9:41       ` n.pettik
2019-03-19 11:24   ` Kirill Yukhin
2019-03-13 17:03 ` [tarantool-patches] [PATCH v4 3/8] sql: replace rc with is_aborted status in struct Parse imeevma
2019-03-14 19:53   ` [tarantool-patches] " n.pettik
2019-03-18 15:28     ` Mergen Imeev
2019-03-19  9:54       ` n.pettik [this message]
2019-03-19 13:17   ` Kirill Yukhin
2019-03-13 17:03 ` [tarantool-patches] [PATCH v4 4/8] sql: remove field nErr from " imeevma
2019-03-14 19:58   ` [tarantool-patches] " n.pettik
2019-03-19 13:27   ` Kirill Yukhin
2019-03-13 17:03 ` [tarantool-patches] [PATCH v4 5/8] sql: remove field zErrMsg " imeevma
2019-03-14 22:15   ` [tarantool-patches] " n.pettik
2019-03-19 13:20   ` Kirill Yukhin
2019-03-13 17:03 ` [tarantool-patches] [PATCH v4 6/8] sql: rework three errors of "unsupported" type imeevma
2019-03-14 22:15   ` [tarantool-patches] " n.pettik
2019-03-19 13:30   ` Kirill Yukhin
2019-03-13 17:03 ` [tarantool-patches] [PATCH v4 7/8] sql: rework semantic errors imeevma
2019-03-15 15:49   ` [tarantool-patches] " n.pettik
2019-03-22 12:48     ` Mergen Imeev
2019-03-26 14:14       ` n.pettik
2019-03-26 16:56         ` Mergen Imeev
2019-03-26 18:16           ` n.pettik
2019-03-26 19:20             ` Mergen Imeev
2019-03-26 21:36               ` n.pettik
2019-03-27  6:48   ` Kirill Yukhin
2019-03-13 17:03 ` [tarantool-patches] [PATCH v4 8/8] sql: remove sqlErrorMsg() imeevma
2019-03-15 13:36   ` [tarantool-patches] " n.pettik
2019-03-25 18:47     ` Mergen Imeev
2019-03-26 13:34       ` n.pettik
2019-03-26 17:52         ` Mergen Imeev
2019-03-26 18:28           ` n.pettik
2019-03-26 19:21             ` Mergen Imeev
2019-03-26 21:36               ` n.pettik
2019-03-27  6:49   ` 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=61975B3B-0FDC-4117-88F9-4EB3A6EC247B@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v4 3/8] sql: replace rc with is_aborted status in struct Parse' \
    /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