From: "n.pettik" <korablev@tarantool.org> To: tarantool-patches@freelists.org Cc: Imeev Mergen <imeevma@tarantool.org> Subject: [tarantool-patches] Re: [PATCH v1 04/12] sql: make SQL_TARANTOOL_ERROR the only errcode of OP_Halt Date: Wed, 15 May 2019 16:18:52 +0300 [thread overview] Message-ID: <EEFA81F0-B62A-402F-B97D-5F363ACE4EBB@tarantool.org> (raw) In-Reply-To: <15369cd674c3a454e66470edfa19f540c81b9dd0.1557056617.git.imeevma@gmail.com> > On 5 May 2019, at 15:17, imeevma@tarantool.org wrote: > > Currently, in OP_Halt, you can get a SQL error other than > SQL_TARANTOOL_ERROR, for example, the SQL_CONSTRAINT error. After > this patch, all errors going through OP_Halt will have SQL error > code SQL_TARANTOOL_ERROR and have diag set. > > diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c > index 9f0d760..85cec85 100644 > --- a/src/box/sql/vdbe.c > +++ b/src/box/sql/vdbe.c > @@ -1031,25 +1031,10 @@ case OP_Halt: { > p->errorAction = (u8)pOp->p2; > p->pc = pcx; > if (p->rc) { > - if (p->rc == SQL_TARANTOOL_ERROR) { > - if (pOp->p4.z != NULL) > - diag_set(ClientError, pOp->p5, pOp->p4.z); > - assert(! diag_is_empty(diag_get())); > - } else if (pOp->p5 != 0) { > - static const char * const azType[] = { "NOT NULL", "UNIQUE", "CHECK", > - "FOREIGN KEY" }; > - testcase( pOp->p5==1); > - testcase( pOp->p5==2); > - testcase( pOp->p5==3); > - testcase( pOp->p5==4); > - sqlVdbeError(p, "%s constraint failed", azType[pOp->p5-1]); > - if (pOp->p4.z) { > - p->zErrMsg = sqlMPrintf(db, "%z: %s", p->zErrMsg, pOp->p4.z); > - } > - } else { > - sqlVdbeError(p, "%s", pOp->p4.z); > - } > - sql_log(pOp->p1, "abort at %d in [%s]: %s", pcx, p->zSql, p->zErrMsg); > + assert(p->rc == SQL_TARANTOOL_ERROR); Still don’t understand why can’t we use only 0/-1 for rc. > + if (pOp->p4.z != NULL) > + diag_set(ClientError, pOp->p5, pOp->p4.z); > + assert(! diag_is_empty(diag_get())); > } > rc = sqlVdbeHalt(p); > assert(rc==SQL_BUSY || rc==SQL_OK || rc==SQL_ERROR); > -- > 2.7.4 > >
next prev parent reply other threads:[~2019-05-15 13:18 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 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 ` n.pettik [this message] 2019-05-25 9:18 ` [tarantool-patches] " 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=EEFA81F0-B62A-402F-B97D-5F363ACE4EBB@tarantool.org \ --to=korablev@tarantool.org \ --cc=imeevma@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH v1 04/12] sql: make SQL_TARANTOOL_ERROR the only errcode of OP_Halt' \ /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