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 v2 5/5] sql: remove field nErr of struct Parse
Date: Tue, 26 Feb 2019 17:48:23 +0300	[thread overview]
Message-ID: <92EF85EB-D241-49D8-9AA6-7D9BD3160B04@tarantool.org> (raw)
In-Reply-To: <4189982e3c44b8dcdd1fe3358c1b42f30fa6d6d2.1551114402.git.imeevma@gmail.com>


> diff --git a/src/box/sql/build.c b/src/box/sql/build.c
> index 6afca4a..6621af4 100644
> --- a/src/box/sql/build.c
> +++ b/src/box/sql/build.c
> @@ -92,7 +92,6 @@ save_record(struct Parse *parser, uint32_t space_id, int reg_key,
> 		diag_set(OutOfMemory, sizeof(*record), "region_alloc",
> 			 "record");
> 		parser->rc = SQL_TARANTOOL_ERROR;
> -		parser->nErr++;
> 		return;
> 	}
> 	record->space_id = space_id;
> @@ -145,9 +144,11 @@ sql_finish_coding(struct Parse *parse_context)
> 			     "Exit with an error if CREATE statement fails"));
> 	}
> 
> -	if (db->mallocFailed || parse_context->nErr != 0) {
> -		if (parse_context->rc == SQL_OK)
> -			parse_context->rc = SQL_ERROR;
> +	if (parse_context->rc == SQL_TARANTOOL_ERROR)

rc == 0 / ! abort

> +		return;
> +	if (db->mallocFailed) {
> +		diag_set(ClientError, ER_SQL_PARSER_GENERIC, "Out of memory”);

Why generic when it is OOM error?

> +		parse_context->rc = SQL_TARANTOOL_ERROR;

rc = -1 / abort = true

> 		return;
> 	}
> 	/*
> @@ -189,13 +190,13 @@ sql_finish_coding(struct Parse *parse_context)
> 		sqlVdbeGoto(v, 1);
> 	}
> 	/* Get the VDBE program ready for execution. */
> -	if (parse_context->nErr == 0 && !db->mallocFailed) {
> +	if (parse_context->rc != SQL_TARANTOOL_ERROR && !db->mallocFailed) {
> 		assert(parse_context->iCacheLevel == 0);
> 		sqlVdbeMakeReady(v, parse_context);
> 		parse_context->rc = SQL_DONE;
> -	} else {
> -		if (parse_context->rc != SQL_TARANTOOL_ERROR)
> -			parse_context->rc = SQL_ERROR;
> +	} else if (parse_context->rc != SQL_TARANTOOL_ERROR) {
> +		diag_set(ClientError, ER_SQL_PARSER_GENERIC, "Out of memory");
> +		parse_context->rc = SQL_TARANTOOL_ERROR;

The same is here and in other places .

      parent reply	other threads:[~2019-02-26 14:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-25 17:14 [tarantool-patches] [PATCH v2 0/5] sql: use diag_set() for errors in SQL imeevma
2019-02-25 17:14 ` [tarantool-patches] [PATCH v2 1/5] sql: remove "syntax error after column name" error imeevma
2019-02-25 19:34   ` [tarantool-patches] " n.pettik
2019-02-27 11:32   ` Kirill Yukhin
2019-02-25 17:14 ` [tarantool-patches] [PATCH v2 2/5] sql: rework syntax errors imeevma
2019-02-25 20:02   ` [tarantool-patches] " n.pettik
2019-02-26  8:24     ` Konstantin Osipov
2019-02-26 12:59       ` n.pettik
2019-02-26 13:12         ` Konstantin Osipov
2019-02-26 15:59       ` Imeev Mergen
2019-02-25 17:14 ` [tarantool-patches] [PATCH v2 3/5] sql: save SQL parser errors in diag_set() imeevma
2019-02-25 23:01   ` [tarantool-patches] " n.pettik
2019-02-26  8:25     ` Konstantin Osipov
2019-02-26 15:29     ` Imeev Mergen
2019-02-25 17:14 ` [tarantool-patches] [PATCH v2 4/5] sql: remove file zErrMsg of struct Parse imeevma
2019-02-26 14:47   ` [tarantool-patches] " n.pettik
2019-02-26 15:36     ` Imeev Mergen
2019-02-26 18:17       ` n.pettik
2019-02-25 17:14 ` [tarantool-patches] [PATCH v2 5/5] sql: remove field nErr " imeevma
2019-02-26  8:27   ` [tarantool-patches] " Konstantin Osipov
2019-02-26 14:48   ` n.pettik [this message]

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=92EF85EB-D241-49D8-9AA6-7D9BD3160B04@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v2 5/5] sql: remove field nErr of 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