[tarantool-patches] [PATCH v1 10/21] sql: remove SQL_RANGE errcode

imeevma at tarantool.org imeevma at tarantool.org
Sat May 25 13:44:46 MSK 2019


Removing this error code is part of getting rid of the SQL error
system.
---
 src/box/sql/sqlInt.h  |  2 --
 src/box/sql/vdbeapi.c | 10 ++--------
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
index e6bd5ba..8da946a 100644
--- a/src/box/sql/sqlInt.h
+++ b/src/box/sql/sqlInt.h
@@ -370,8 +370,6 @@ enum sql_ret_code {
 	SQL_TOOBIG,
 	/** Abort due to constraint violation. */
 	SQL_CONSTRAINT,
-	/** 2nd parameter to sql_bind out of range. */
-	SQL_RANGE,
 	SQL_TARANTOOL_ERROR,
 	/** sql_step() has another row ready. */
 	SQL_ROW,
diff --git a/src/box/sql/vdbeapi.c b/src/box/sql/vdbeapi.c
index c4891a5..c697efb 100644
--- a/src/box/sql/vdbeapi.c
+++ b/src/box/sql/vdbeapi.c
@@ -965,11 +965,7 @@ sql_column_origin_name(sql_stmt * pStmt, int N)
  */
 /*
  * Unbind the value bound to variable i in virtual machine p. This is the
- * the same as binding a NULL value to the column. If the "i" parameter is
- * out of range, then SQL_RANGE is returned. Othewise 0.
- *
- * The error code stored in database p->db is overwritten with the return
- * value in any case.
+ * the same as binding a NULL value to the column.
  */
 static int
 vdbeUnbind(Vdbe * p, int i)
@@ -977,9 +973,7 @@ vdbeUnbind(Vdbe * p, int i)
 	Mem *pVar;
 	assert(p != NULL);
 	assert(p->magic == VDBE_MAGIC_RUN && p->pc < 0);
-	if (i < 1 || i > p->nVar) {
-		return SQL_RANGE;
-	}
+	assert(i > 0 && i <= p->nVar);
 	i--;
 	pVar = &p->aVar[i];
 	sqlVdbeMemRelease(pVar);
-- 
2.7.4





More information about the Tarantool-patches mailing list