From: Imeev Mergen <imeevma@tarantool.org> To: "n.pettik" <korablev@tarantool.org>, tarantool-patches@freelists.org Subject: [tarantool-patches] Re: [PATCH v1 01/12] sql: remove errors SQL_TARANTOOL_*_FAIL Date: Sat, 25 May 2019 12:16:44 +0300 [thread overview] Message-ID: <33554197-bc36-1792-75a1-027fb0d8dce0@tarantool.org> (raw) In-Reply-To: <31ACAB6A-811A-46AC-8D35-B30524A85FE8@tarantool.org> Hi! Thank you for review! My answers below. On 5/15/19 4:18 PM, n.pettik wrote: > >> On 5 May 2019, at 15:17, imeevma@tarantool.org wrote: >> >> 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. Fixed. > >> 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()); >> } >> >> 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 != NULL); >> mp_tuple_assert(tuple, tuple_end); >> if (space_ephemeral_replace(space, tuple, tuple_end) != 0) >> - return SQL_TARANTOOL_INSERT_FAIL; >> + return SQL_TARANTOOL_ERROR; > Let’s 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 I think it's better to leave it as it is. A bit later there will be a patch-set, in which all SQL error codes will be replaced with either 0 or -1. > >> 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(); >> >> -int is_tarantool_error(int rc); >> - >> /* Storage interface. */ >> const void *tarantoolsqlPayloadFetch(BtCursor * pCur, u32 * pAmt); >> >> @@ -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 == SQL_TARANTOOL_ERROR && tarantoolErrorMessage()) { > Isn’t tarantoolErrorMessage redundant check? Is it possible > to use SQL_TARANTOOL_ERROR without set diag? It is technically possible to install SQL_TARANTOOL_ERROR without set diag. This code will be fixed in one of the following patches of this patch-set.
next prev parent reply other threads:[~2019-05-25 9:16 UTC|newest] Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-05-05 12:17 [tarantool-patches] [PATCH v1 00/12] sql: set errors in VDBE using diag_set() imeevma 2019-05-05 12:17 ` [tarantool-patches] [PATCH v1 01/12] sql: remove errors SQL_TARANTOOL_*_FAIL imeevma 2019-05-15 13:18 ` [tarantool-patches] " n.pettik 2019-05-25 9:16 ` Imeev Mergen [this message] 2019-05-05 12:17 ` [tarantool-patches] [PATCH v1 02/12] sql: remove error ER_SQL imeevma 2019-05-15 13:18 ` [tarantool-patches] " n.pettik 2019-05-05 12:17 ` [tarantool-patches] [PATCH v1 03/12] sql: rework diag_set() in OP_Halt imeevma 2019-05-15 13:18 ` [tarantool-patches] " n.pettik 2019-05-05 12:17 ` [tarantool-patches] [PATCH v1 04/12] sql: make SQL_TARANTOOL_ERROR the only errcode of OP_Halt imeevma 2019-05-15 13:18 ` [tarantool-patches] " n.pettik 2019-05-25 9:18 ` Imeev Mergen 2019-05-05 12:17 ` [tarantool-patches] [PATCH v1 05/12] sql: remove error SQL_INTERRUPT imeevma 2019-05-15 13:18 ` [tarantool-patches] " n.pettik 2019-05-05 12:17 ` [tarantool-patches] [PATCH v1 06/12] sql: remove error SQL_MISMATCH imeevma 2019-05-15 13:19 ` [tarantool-patches] " n.pettik 2019-05-05 12:17 ` [tarantool-patches] [PATCH v1 07/12] sql: set errors in VDBE using diag_set() imeevma 2019-05-15 13:26 ` [tarantool-patches] " n.pettik 2019-05-25 10:24 ` Mergen Imeev 2019-05-25 10:36 ` Imeev Mergen 2019-05-05 12:17 ` [tarantool-patches] [PATCH v1 08/12] sql: remove field zErrMsg from struct Vdbe imeevma 2019-05-15 13:30 ` [tarantool-patches] " n.pettik 2019-05-25 9:25 ` Imeev Mergen 2019-05-05 12:17 ` [tarantool-patches] [PATCH v1 09/12] sql: remove field pErr from struct sql imeevma 2019-05-05 12:17 ` [tarantool-patches] [PATCH v1 10/12] sql: remove field errCode " imeevma 2019-05-15 13:32 ` [tarantool-patches] " n.pettik 2019-05-25 9:25 ` Imeev Mergen 2019-05-05 12:17 ` [tarantool-patches] [PATCH v1 11/12] sql: remove sqlError() and remove sqlErrorWithMsg() imeevma 2019-05-05 12:17 ` [tarantool-patches] [PATCH v1 12/12] sql: use diag_set() to set an error in SQL functions imeevma 2019-05-15 14:12 ` [tarantool-patches] " n.pettik 2019-05-25 9:45 ` Mergen Imeev 2019-05-25 10:36 ` Imeev Mergen
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=33554197-bc36-1792-75a1-027fb0d8dce0@tarantool.org \ --to=imeevma@tarantool.org \ --cc=korablev@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH v1 01/12] sql: remove errors SQL_TARANTOOL_*_FAIL' \ /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