Tarantool development patches archive
 help / color / mirror / Atom feed
From: imeevma@tarantool.org
To: korablev@tarantool.org
Cc: tarantool-patches@freelists.org
Subject: [tarantool-patches] [PATCH v1 08/12] sql: remove field zErrMsg from struct Vdbe
Date: Sun,  5 May 2019 15:17:15 +0300	[thread overview]
Message-ID: <ce04c62e86ba53e179f64827d04dce12771cc94a.1557056617.git.imeevma@gmail.com> (raw)
In-Reply-To: <cover.1557056617.git.imeevma@gmail.com>

This field become unused and should be removed.
---
 src/box/sql/vdbeInt.h |  1 -
 src/box/sql/vdbeaux.c | 29 ++++-------------------------
 2 files changed, 4 insertions(+), 26 deletions(-)

diff --git a/src/box/sql/vdbeInt.h b/src/box/sql/vdbeInt.h
index b655b5a..de9dbd6 100644
--- a/src/box/sql/vdbeInt.h
+++ b/src/box/sql/vdbeInt.h
@@ -404,7 +404,6 @@ struct Vdbe {
 	Mem **apArg;		/* Arguments to currently executing user function */
 	Mem *aColName;		/* Column names to return */
 	Mem *pResultSet;	/* Pointer to an array of results */
-	char *zErrMsg;		/* Error message written here */
 	VdbeCursor **apCsr;	/* One element of this array for each open cursor */
 	Mem *aVar;		/* Values for the OP_Variable opcode. */
 	/**
diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c
index 48c2a81..300a44b 100644
--- a/src/box/sql/vdbeaux.c
+++ b/src/box/sql/vdbeaux.c
@@ -1966,7 +1966,6 @@ closeCursorsAndFree(Vdbe * p)
 static void
 Cleanup(Vdbe * p)
 {
-	sql *db = p->db;
 
 #ifdef SQL_DEBUG
 	/* Execute assert() statements to ensure that the Vdbe.apCsr[] and
@@ -1982,8 +1981,6 @@ Cleanup(Vdbe * p)
 	}
 #endif
 
-	sqlDbFree(db, p->zErrMsg);
-	p->zErrMsg = 0;
 	p->pResultSet = 0;
 }
 
@@ -2326,8 +2323,6 @@ sqlVdbeHalt(Vdbe * p)
 				if (p->rc == SQL_OK
 				    || (p->rc & 0xff) == SQL_CONSTRAINT) {
 					p->rc = rc;
-					sqlDbFree(db, p->zErrMsg);
-					p->zErrMsg = 0;
 				}
 				closeCursorsAndFree(p);
 				sqlRollbackAll(p);
@@ -2390,24 +2385,13 @@ sqlVdbeTransferError(Vdbe * p)
 {
 	sql *db = p->db;
 	int rc = p->rc;
-	if (p->zErrMsg) {
-		db->bBenignMalloc++;
-		sqlBeginBenignMalloc();
-		if (db->pErr == 0)
-			db->pErr = sqlValueNew(db);
-		sqlValueSetStr(db->pErr, -1, p->zErrMsg, SQL_TRANSIENT);
-		sqlEndBenignMalloc();
-		db->bBenignMalloc--;
-		db->errCode = rc;
-	} else {
-		sqlError(db, rc);
-	}
+	sqlError(db, rc);
 	return rc;
 }
 
 /*
  * Clean up a VDBE after execution but do not delete the VDBE just yet.
- * Write any error messages into *pzErrMsg.  Return the result code.
+ * Return the result code.
  *
  * After this routine is run, the VDBE should be ready to be executed
  * again.
@@ -2435,8 +2419,6 @@ sqlVdbeReset(Vdbe * p)
 	 */
 	if (p->pc >= 0) {
 		sqlVdbeTransferError(p);
-		sqlDbFree(db, p->zErrMsg);
-		p->zErrMsg = 0;
 		if (p->runOnlyOnce)
 			p->expired = 1;
 	} else if (p->rc && p->expired) {
@@ -2444,10 +2426,7 @@ sqlVdbeReset(Vdbe * p)
 		 * to sql_step(). For consistency (since sql_step() was
 		 * called), set the database error in this case as well.
 		 */
-		sqlErrorWithMsg(db, p->rc, p->zErrMsg ? "%s" : 0,
-				    p->zErrMsg);
-		sqlDbFree(db, p->zErrMsg);
-		p->zErrMsg = 0;
+		sqlErrorWithMsg(db, p->rc, NULL);
 	}
 
 	/* Reclaim all memory used by the VDBE
@@ -2501,7 +2480,7 @@ sqlVdbeReset(Vdbe * p)
 
 /*
  * Clean up and delete a VDBE after execution.  Return an integer which is
- * the result code.  Write any error message text into *pzErrMsg.
+ * the result code.
  */
 int
 sqlVdbeFinalize(Vdbe * p)
-- 
2.7.4

  parent reply	other threads:[~2019-05-05 12:17 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   ` [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 ` imeevma [this message]
2019-05-15 13:30   ` [tarantool-patches] Re: [PATCH v1 08/12] sql: remove field zErrMsg from struct Vdbe 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=ce04c62e86ba53e179f64827d04dce12771cc94a.1557056617.git.imeevma@gmail.com \
    --to=imeevma@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH v1 08/12] sql: remove field zErrMsg from struct Vdbe' \
    /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