Tarantool development patches archive
 help / color / mirror / Atom feed
From: Mergen Imeev <imeevma@tarantool.org>
To: "n.pettik" <korablev@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: [tarantool-patches] Re: [PATCH v4 8/8] sql: remove sqlErrorMsg()
Date: Tue, 26 Mar 2019 22:21:34 +0300	[thread overview]
Message-ID: <20190326192134.GB30904@tarantool.org> (raw)
In-Reply-To: <E6B9A671-5627-434A-8CFF-91F6A45E4ECA@tarantool.org>

On Tue, Mar 26, 2019 at 09:28:21PM +0300, n.pettik wrote:
> 
> > diff --git a/src/box/sql/select.c b/src/box/sql/select.c
> > index e217c19..778de2c 100644
> > --- a/src/box/sql/select.c
> > +++ b/src/box/sql/select.c
> > @@ -1466,25 +1466,25 @@ sql_expr_list_to_key_info(struct Parse *parse, struct ExprList *list, int start)
> > /*
> >  * Name of the connection operator, used for error messages.
> >  */
> > -static const char *
> > -selectOpName(int id)
> > +const char *
> > +select_op_name(int op_id)
> 
> Add sql_ prefix.
> 
Fixed.

> > {
> > -	char *z;
> > -	switch (id) {
> > +	const char *op_name;
> 
> IMHO don’t see much sense in this renaming: function is small and straight
> enough to use old brief names.
> 
Reverted these changes back.

Diff:

diff --git a/src/box/sql/resolve.c b/src/box/sql/resolve.c
index a12e7ad..dd51151 100644
--- a/src/box/sql/resolve.c
+++ b/src/box/sql/resolve.c
@@ -1460,7 +1460,8 @@ resolveSelectStep(Walker * pWalker, Select * p)
 					"SELECTs to the left and right of %s "\
 					"do not have the same number of "\
 					"result columns";
-				const char *op = select_op_name(p->pNext->op);
+				const char *op =
+					sql_select_op_name(p->pNext->op);
 				diag_set(ClientError, ER_SQL_PARSER_GENERIC,
 					 tt_sprintf(err, op));
 			}
diff --git a/src/box/sql/select.c b/src/box/sql/select.c
index 778de2c..2ab4761 100644
--- a/src/box/sql/select.c
+++ b/src/box/sql/select.c
@@ -1463,28 +1463,25 @@ sql_expr_list_to_key_info(struct Parse *parse, struct ExprList *list, int start)
 	return key_info;
 }
 
-/*
- * Name of the connection operator, used for error messages.
- */
 const char *
-select_op_name(int op_id)
+sql_select_op_name(int id)
 {
-	const char *op_name;
-	switch (op_id) {
+	char *z;
+	switch (id) {
 	case TK_ALL:
-		op_name = "UNION ALL";
+		z = "UNION ALL";
 		break;
 	case TK_INTERSECT:
-		op_name = "INTERSECT";
+		z = "INTERSECT";
 		break;
 	case TK_EXCEPT:
-		op_name = "EXCEPT";
+		z = "EXCEPT";
 		break;
 	default:
-		op_name = "UNION";
+		z = "UNION";
 		break;
 	}
-	return op_name;
+	return z;
 }
 
 /*
@@ -1542,7 +1539,7 @@ explainComposite(Parse * pParse,	/* Parse context */
 				   "COMPOUND SUBQUERIES %d AND %d %s(%s)",
 				   iSub1, iSub2,
 				   bUseTmp ? "USING TEMP B-TREE " : "",
-				   select_op_name(op)
+				   sql_select_op_name(op)
 		    );
 		sqlVdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg,
 				  P4_DYNAMIC);
@@ -2614,7 +2611,7 @@ multiSelect(Parse * pParse,	/* Parsing context */
 	if (pPrior->pOrderBy) {
 		const char *err_msg =
 			tt_sprintf("ORDER BY clause should come after %s not "\
-				   "before", select_op_name(p->op));
+				   "before", sql_select_op_name(p->op));
 		diag_set(ClientError, ER_SQL_PARSER_GENERIC, err_msg);
 		pParse->is_aborted = true;
 		rc = 1;
@@ -2623,7 +2620,7 @@ multiSelect(Parse * pParse,	/* Parsing context */
 	if (pPrior->pLimit) {
 		const char *err_msg =
 			tt_sprintf("LIMIT clause should come after %s not "\
-				   "before", select_op_name(p->op));
+				   "before", sql_select_op_name(p->op));
 		diag_set(ClientError, ER_SQL_PARSER_GENERIC, err_msg);
 		pParse->is_aborted = true;
 		rc = 1;
diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
index 50fc812..b32c3d3 100644
--- a/src/box/sql/sqlInt.h
+++ b/src/box/sql/sqlInt.h
@@ -4429,11 +4429,11 @@ void sqlSelectPrep(Parse *, Select *, NameContext *);
 /**
  * Returns name of the connection operator.
  *
- * @param op_id ID of the connection operator.
+ * @param id ID of the connection operator.
  * @retval Name of the connection operator.
  */
 const char *
-select_op_name(int op_id);
+sql_select_op_name(int id);
 
 int sqlMatchSpanName(const char *, const char *, const char *);
 int sqlResolveExprNames(NameContext *, Expr *);

  reply	other threads:[~2019-03-26 19:21 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
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 [this message]
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=20190326192134.GB30904@tarantool.org \
    --to=imeevma@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v4 8/8] sql: remove sqlErrorMsg()' \
    /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