[tarantool-patches] Re: [PATCH v1 20/21] sql: replace rc by is_aborted in struct Parse

Mergen Imeev imeevma at tarantool.org
Sun May 26 12:49:53 MSK 2019


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.
  *





More information about the Tarantool-patches mailing list