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 975F01FC3B for ; Sun, 26 May 2019 05:49:56 -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 k6hqyEhDHVGn for ; Sun, 26 May 2019 05:49:56 -0400 (EDT) Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (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 5692C28F4F for ; Sun, 26 May 2019 05:49:56 -0400 (EDT) Date: Sun, 26 May 2019 12:49:53 +0300 From: Mergen Imeev Subject: [tarantool-patches] Re: [PATCH v1 20/21] sql: replace rc by is_aborted in struct Parse Message-ID: <20190526094953.GD20428@tarantool.org> References: <8c0e8883707211ef5db388c6a4826ec4764f8fbd.1558780708.git.imeevma@gmail.com> <5D7AD1A8-C437-4608-AE09-A8A9E29625EA@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <5D7AD1A8-C437-4608-AE09-A8A9E29625EA@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: "n.pettik" Cc: tarantool-patches@freelists.org On Sat, May 25, 2019 at 06:46:34PM +0300, n.pettik wrote: > > Not struct Parse, but struct Vdbe. > Fixed: sql: replace rc by is_aborted in struct VDBE Currently, the rc field of the VDBE structure is either 0 or -1. Due to this, it is better to replace this integer field with the boolean field is_aborted. > > diff --git a/src/box/sql/vdbeapi.c b/src/box/sql/vdbeapi.c > > index 1842e26..0a4f45f 100644 > > --- a/src/box/sql/vdbeapi.c > > +++ b/src/box/sql/vdbeapi.c > > > > > > diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c > > index 28b423d..944a8a7 100644 > > --- a/src/box/sql/vdbeaux.c > > +++ b/src/box/sql/vdbeaux.c > > > > @@ -1703,7 +1701,6 @@ sqlVdbeRewind(Vdbe * p) > > } > > #endif > > p->pc = -1; > > - p->rc = 0; > > Why not setting here is_aborted = false; ? > > Fixed. Also, I returned the sqlVdbeResetStepResult() function, since it is now used in seqReprepare(). Diff: diff --git a/src/box/sql/vdbe.h b/src/box/sql/vdbe.h index c8f2618..6234dff 100644 --- a/src/box/sql/vdbe.h +++ b/src/box/sql/vdbe.h @@ -253,6 +253,7 @@ void sqlVdbeMakeReady(Vdbe *, Parse *); int sqlVdbeFinalize(Vdbe *); void sqlVdbeResolveLabel(Vdbe *, int); int sqlVdbeCurrentAddr(Vdbe *); +void sqlVdbeResetStepResult(Vdbe *); void sqlVdbeRewind(Vdbe *); int sqlVdbeReset(Vdbe *); void sqlVdbeSetNumCols(Vdbe *, int); diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c index 944a8a7..ec303c7 100644 --- a/src/box/sql/vdbeaux.c +++ b/src/box/sql/vdbeaux.c @@ -1701,6 +1701,7 @@ sqlVdbeRewind(Vdbe * p) } #endif p->pc = -1; + p->is_aborted = false; p->ignoreRaised = 0; p->errorAction = ON_CONFLICT_ACTION_ABORT; p->nChange = 0; @@ -2288,6 +2289,15 @@ sqlVdbeHalt(Vdbe * p) } /* + * This routine sets is_aborted of VDBE to false. + */ +void +sqlVdbeResetStepResult(Vdbe * p) +{ + p->is_aborted = false; +} + +/* * Clean up a VDBE after execution but do not delete the VDBE just yet. * Return the result code. *