[tarantool-patches] [PATCH v2 3/4] sql: remove total_changes() function

Nikita Pettik korablev at tarantool.org
Tue Nov 13 19:11:22 MSK 2018


Part of #2181
---
 src/box/sql/func.c      | 17 -----------------
 src/box/sql/main.c      | 15 ---------------
 src/box/sql/sqliteInt.h |  4 ----
 src/box/sql/vdbeaux.c   |  1 -
 4 files changed, 37 deletions(-)

diff --git a/src/box/sql/func.c b/src/box/sql/func.c
index 8c34cbb3d..5ab64821b 100644
--- a/src/box/sql/func.c
+++ b/src/box/sql/func.c
@@ -600,21 +600,6 @@ changes(sqlite3_context * context, int NotUsed, sqlite3_value ** NotUsed2)
 	sqlite3_result_int(context, sqlite3_changes(db));
 }
 
-/*
- * Implementation of the total_changes() SQL function.  The return value is
- * the same as the sqlite3_total_changes() API function.
- */
-static void
-total_changes(sqlite3_context * context, int NotUsed, sqlite3_value ** NotUsed2)
-{
-	sqlite3 *db = sqlite3_context_db_handle(context);
-	UNUSED_PARAMETER2(NotUsed, NotUsed2);
-	/* IMP: R-52756-41993 This function is a wrapper around the
-	 * sqlite3_total_changes() C/C++ interface.
-	 */
-	sqlite3_result_int(context, sqlite3_total_changes(db));
-}
-
 /*
  * A structure defining how to do GLOB-style comparisons.
  */
@@ -1869,8 +1854,6 @@ sqlite3RegisterBuiltinFunctions(void)
 		FUNCTION(version, 0, 0, 0, sql_func_version, AFFINITY_TEXT),
 		FUNCTION(quote, 1, 0, 0, quoteFunc, AFFINITY_TEXT),
 		VFUNCTION(changes, 0, 0, 0, changes, AFFINITY_INTEGER),
-		VFUNCTION(total_changes, 0, 0, 0, total_changes,
-			  AFFINITY_INTEGER),
 		FUNCTION(replace, 3, 0, 0, replaceFunc, AFFINITY_TEXT),
 		FUNCTION(zeroblob, 1, 0, 0, zeroblobFunc, AFFINITY_BLOB),
 		FUNCTION(substr, 2, 0, 0, substrFunc, AFFINITY_TEXT),
diff --git a/src/box/sql/main.c b/src/box/sql/main.c
index e1d61621f..76c152c68 100644
--- a/src/box/sql/main.c
+++ b/src/box/sql/main.c
@@ -498,21 +498,6 @@ sqlite3_changes(sqlite3 * db)
 	return db->nChange;
 }
 
-/*
- * Return the number of changes since the database handle was opened.
- */
-int
-sqlite3_total_changes(sqlite3 * db)
-{
-#ifdef SQLITE_ENABLE_API_ARMOR
-	if (!sqlite3SafetyCheckOk(db)) {
-		(void)SQLITE_MISUSE_BKPT;
-		return 0;
-	}
-#endif
-	return db->nTotalChange;
-}
-
 /*
  * Close all open savepoints.
  * This procedure is trivial as savepoints are allocated on the "region" and
diff --git a/src/box/sql/sqliteInt.h b/src/box/sql/sqliteInt.h
index 1999ff568..73ca35c11 100644
--- a/src/box/sql/sqliteInt.h
+++ b/src/box/sql/sqliteInt.h
@@ -657,9 +657,6 @@ sqlite3_randomness(int N, void *P);
 int
 sqlite3_changes(sqlite3 *);
 
-int
-sqlite3_total_changes(sqlite3 *);
-
 void *
 sqlite3_user_data(sqlite3_context *);
 
@@ -1516,7 +1513,6 @@ struct sqlite3 {
 	u8 mTrace;		/* zero or more SQLITE_TRACE flags */
 	u32 magic;		/* Magic number for detect library misuse */
 	int nChange;		/* Value returned by sqlite3_changes() */
-	int nTotalChange;	/* Value returned by sqlite3_total_changes() */
 	int aLimit[SQLITE_N_LIMIT];	/* Limits */
 	int nMaxSorterMmap;	/* Maximum size of regions mapped by sorter */
 	struct sqlite3InitInfo {	/* Information used during initialization */
diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c
index e0bf92acf..c0945d36d 100644
--- a/src/box/sql/vdbeaux.c
+++ b/src/box/sql/vdbeaux.c
@@ -3453,7 +3453,6 @@ void
 sqlite3VdbeSetChanges(sqlite3 * db, int nChange)
 {
 	db->nChange = nChange;
-	db->nTotalChange += nChange;
 }
 
 /*
-- 
2.15.1





More information about the Tarantool-patches mailing list