From a10f34630c7f8cef4a808179930ade3f64624b1f Mon Sep 17 00:00:00 2001
From: Mergen Imeev <imeevma@gmail.com>
Date: Tue, 21 May 2019 17:07:08 +0300
Subject: [PATCH] sql: remove SQL_LOCKED errcode

Removing this error code is part of getting rid of the SQL error
system.
---
 src/box/sql/prepare.c |  5 -----
 src/box/sql/sqlInt.h  |  2 --
 src/box/sql/vdbeapi.c | 15 +--------------
 3 files changed, 1 insertion(+), 21 deletions(-)

diff --git a/src/box/sql/prepare.c b/src/box/sql/prepare.c
index 7a8a2d8100..3ed1269748 100644
--- a/src/box/sql/prepare.c
+++ b/src/box/sql/prepare.c
@@ -207,11 +207,6 @@ sqlLockAndPrepare(sql * db,		/* Database handle. */
 
 /*
  * Rerun the compilation of a statement after a schema change.
- *
- * If the statement is successfully recompiled, return 0. Otherwise,
- * if the statement cannot be recompiled because another connection has
- * locked the sql_master table, return SQL_LOCKED. If any other error
- * occurs, return SQL_SCHEMA.
  */
 int
 sqlReprepare(Vdbe * p)
diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
index 0fe63a0938..75bd4b2b0f 100644
--- a/src/box/sql/sqlInt.h
+++ b/src/box/sql/sqlInt.h
@@ -329,8 +329,6 @@ enum sql_ret_code {
 	SQL_ERROR = 1,
 	/** The database file is locked. */
 	SQL_BUSY,
-	/** A table in the database is locked. */
-	SQL_LOCKED,
 	/** A malloc() failed. */
 	SQL_NOMEM,
 	/** Some kind of disk I/O error occurred. */
diff --git a/src/box/sql/vdbeapi.c b/src/box/sql/vdbeapi.c
index fc34722cb3..bd32ad5760 100644
--- a/src/box/sql/vdbeapi.c
+++ b/src/box/sql/vdbeapi.c
@@ -413,21 +413,8 @@ sqlStep(Vdbe * p)
 	int rc;
 
 	assert(p);
-	if (p->magic != VDBE_MAGIC_RUN) {
-		/* We used to require that sql_reset() be called before retrying
-		 * sql_step() after any error or after SQL_DONE.  But beginning
-		 * with version 3.7.0, we changed this so that sql_reset() would
-		 * be called automatically instead of throwing the SQL_MISUSE error.
-		 * This "automatic-reset" change is not technically an incompatibility,
-		 * since any application that receives an SQL_MISUSE is broken by
-		 * definition.
-		 *
-		 * Nevertheless, some published applications that were originally written
-		 * for version 3.6.23 or earlier do in fact depend on SQL_MISUSE
-		 * returns, and those were broken by the automatic-reset change.
-		 */
+	if (p->magic != VDBE_MAGIC_RUN)
 		sql_reset((sql_stmt *) p);
-	}
 
 	/* Check that malloc() has not failed. If it has, return early. */
 	db = p->db;
-- 
GitLab