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 6CA2B2E737 for ; Wed, 15 May 2019 09:18:43 -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 s_v1P4q3unra for ; Wed, 15 May 2019 09:18:43 -0400 (EDT) Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 2A3592B604 for ; Wed, 15 May 2019 09:18:43 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Subject: [tarantool-patches] Re: [PATCH v1 01/12] sql: remove errors SQL_TARANTOOL_*_FAIL From: "n.pettik" In-Reply-To: <4e95d48acff0665630f766d394a36763582ef00b.1557056617.git.imeevma@gmail.com> Date: Wed, 15 May 2019 16:18:40 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <31ACAB6A-811A-46AC-8D35-B30524A85FE8@tarantool.org> References: <4e95d48acff0665630f766d394a36763582ef00b.1557056617.git.imeevma@gmail.com> 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 > On 5 May 2019, at 15:17, imeevma@tarantool.org wrote: >=20 > Errors SQL_TARANTOOL_DELETE_FAIL, SQL_TARANTOOL_ITERATOR_FAIL and > SQL_TARANTOOL_INSERT_FAIL have almost no functionality, but can Nit: they are not errors, but rather error codes. > diff --git a/src/box/sql.c b/src/box/sql.c > index 1fb93e1..3593242 100644 > --- a/src/box/sql.c > +++ b/src/box/sql.c > @@ -162,15 +162,6 @@ const char *tarantoolErrorMessage() > return box_error_message(box_error_last()); > } >=20 > const void *tarantoolsqlPayloadFetch(BtCursor *pCur, u32 *pAmt) > { > assert(pCur->curFlags & BTCF_TaCursor || > @@ -421,7 +412,7 @@ int tarantoolsqlEphemeralInsert(struct space = *space, const char *tuple, > assert(space !=3D NULL); > mp_tuple_assert(tuple, tuple_end); > if (space_ephemeral_replace(space, tuple, tuple_end) !=3D 0) > - return SQL_TARANTOOL_INSERT_FAIL; > + return SQL_TARANTOOL_ERROR; Let=E2=80=99s return -1 and set tarantool_error only in VDBE. Later, we are going to replace tarantool_error with -1 everywhere. The same concerns other tarantool_error usages in sql.c > diff --git a/src/box/sql/tarantoolInt.h b/src/box/sql/tarantoolInt.h > index 2b04d96..f15e147 100644 > --- a/src/box/sql/tarantoolInt.h > +++ b/src/box/sql/tarantoolInt.h > @@ -13,8 +13,6 @@ struct fk_constraint_def; > /* Misc */ > const char *tarantoolErrorMessage(); >=20 > -int is_tarantool_error(int rc); > - > /* Storage interface. */ > const void *tarantoolsqlPayloadFetch(BtCursor * pCur, u32 * pAmt); >=20 > @@ -51,8 +49,7 @@ int tarantoolsqlDelete(BtCursor * pCur, u8 flags); > * @param key Key of record to be deleted. > * @param key_size Size of key. > * > - * @retval SQL_OK on success, SQL_TARANTOOL_DELETE_FAIL > - * otherwise. > + * @retval SQL_OK on success, SQL_TARANTOOL_ERROR otherwise. > */ > int > sql_delete_by_key(struct space *space, uint32_t iid, char *key, > diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c > index 3bd8223..5222a4e 100644 > --- a/src/box/sql/vdbe.c > +++ b/src/box/sql/vdbe.c > @@ -5469,7 +5469,7 @@ abort_due_to_error: > /* Avoiding situation when Tarantool error is set, > * but error message isn't. > */ > - if (is_tarantool_error(rc) && tarantoolErrorMessage()) { > + if (rc =3D=3D SQL_TARANTOOL_ERROR && = tarantoolErrorMessage()) { Isn=E2=80=99t tarantoolErrorMessage redundant check? Is it possible to use SQL_TARANTOOL_ERROR without set diag?