[tarantool-patches] [PATCH v1 1/3] sql: get rid of SQL_NullCallback flag

Kirill Shcherbatov kshcherbatov at tarantool.org
Wed May 15 20:34:28 MSK 2019


The SQL_NullCallback flag is never set now so it redundant.
Let's get red if it because we are going to pass
user_session->sql_flags to parser and use it instead of
session instance.

Needed for #3691
---
 src/box/sql/legacy.c | 6 +-----
 src/box/sql/sqlInt.h | 2 --
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/box/sql/legacy.c b/src/box/sql/legacy.c
index ee680efe2..a57677e89 100644
--- a/src/box/sql/legacy.c
+++ b/src/box/sql/legacy.c
@@ -63,7 +63,6 @@ sql_exec(sql * db,	/* The database on which the SQL executes */
 	sql_stmt *pStmt = 0;	/* The current SQL statement */
 	char **azCols = 0;	/* Names of result columns */
 	int callbackIsInit;	/* True if callback data is initialized */
-	struct session *user_session = current_session();
 
 	if (!sqlSafetyCheckOk(db))
 		return SQL_MISUSE;
@@ -94,10 +93,7 @@ sql_exec(sql * db,	/* The database on which the SQL executes */
 			int i;
 			rc = sql_step(pStmt);
 			/* Invoke the callback function if required */
-			if (xCallback && (SQL_ROW == rc ||
-					  (SQL_DONE == rc && !callbackIsInit
-					   && user_session->
-					   sql_flags & SQL_NullCallback))) {
+			if (xCallback != NULL && rc == SQL_ROW) {
 				if (!callbackIsInit) {
 					azCols =
 					    sqlDbMallocZero(db,
diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
index 997a46535..d2be6701f 100644
--- a/src/box/sql/sqlInt.h
+++ b/src/box/sql/sqlInt.h
@@ -1498,8 +1498,6 @@ struct sql {
 #define SQL_CountRows      0x00000080	/* Count rows changed by INSERT, */
 					  /*   DELETE, or UPDATE and return */
 					  /*   the count using a callback. */
-#define SQL_NullCallback   0x00000100	/* Invoke the callback once if the */
-					  /*   result set is empty */
 #define SQL_SqlTrace       0x00000200	/* Debug print SQL as it executes */
 #define SQL_SelectTrace    0x00000800       /* Debug info about select statement */
 #define SQL_WhereTrace     0x00008000       /* Debug info about optimizer's work */
-- 
2.21.0





More information about the Tarantool-patches mailing list