From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 22FBD289D1 for ; Tue, 26 Mar 2019 14:16:11 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id spT9TYZgCJKT for ; Tue, 26 Mar 2019 14:16:11 -0400 (EDT) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 9C35E29F7C for ; Tue, 26 Mar 2019 14:16:10 -0400 (EDT) From: "n.pettik" Message-Id: <9EFBE722-AEB3-4592-AD43-BEC564893529@tarantool.org> Content-Type: multipart/alternative; boundary="Apple-Mail=_EB600338-34D2-458A-9798-82EC68178814" Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: [tarantool-patches] Re: [PATCH v4 7/8] sql: rework semantic errors Date: Tue, 26 Mar 2019 21:16:08 +0300 In-Reply-To: <20190326165653.GA3149@tarantool.org> References: <6dca562ff5163f5579f45d175b6cf188db52a09f.1552494059.git.imeevma@gmail.com> <53DBABF2-8730-4FF6-9C23-64BF3F9986D1@tarantool.org> <20190322124822.GA7890@tarantool.org> <08DAB5A5-C5B9-4D0F-B3C3-D3B29505B2D0@tarantool.org> <20190326165653.GA3149@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org Cc: imeev Mergen --Apple-Mail=_EB600338-34D2-458A-9798-82EC68178814 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > #if SQL_MAX_COLUMN > if (pOrderBy->nExpr > db->aLimit[SQL_LIMIT_COLUMN]) { > - const char *err_msg =3D > - is_order_by ? "The number of terms in ORDER BY = clause" : > - "The number of terms in GROUP BY = clause"; > + const char *err_msg; > + if (zType[0] !=3D 'G') > + err_msg =3D "The number of terms in ORDER BY = clause"; > + else > + err_msg =3D "The number of terms in GROUP BY = clause=E2=80=9D; Just use format string and sprintf - it allows to remove branching (like it was in original SQLite code). >=20 > New patch: >=20 Please, don=E2=80=99t attach whole huge patch when it comes for several = light-fixes. I won=E2=80=99t look at it anyway. --Apple-Mail=_EB600338-34D2-458A-9798-82EC68178814 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

#if = SQL_MAX_COLUMN
= if = (pOrderBy->nExpr > db->aLimit[SQL_LIMIT_COLUMN]) {
- const char *err_msg =3D
- = is_order_by ? = "The number of terms in ORDER BY clause" :
- =       = ;"The number of terms in GROUP BY clause";
+ = const char = *err_msg;
+ if (zType[0] !=3D 'G')
+ = err_msg =3D = "The number of terms in ORDER BY clause";
+ = else
+ = err_msg =3D = "The number of terms in GROUP BY clause=E2=80=9D;

Just use = format string and sprintf - it allows to remove = branching
(like it was in original SQLite code).


New patch:


Please, = don=E2=80=99t attach whole huge patch when it comes for several = light-fixes.
I won=E2=80=99t look at it anyway.

= --Apple-Mail=_EB600338-34D2-458A-9798-82EC68178814--