[Tarantool-patches] [PATCH v4 07/53] sql: disable unused code in sql/vdbemem.c

imeevma at tarantool.org imeevma at tarantool.org
Tue Mar 23 12:35:08 MSK 2021


This patch disables unused code in sql/vdbemem.c. It will simplify
refactoring.

Part of #5818
---
 src/box/sql/sqlInt.h  | 69 ++++++++++++++++++++++++++++---------------
 src/box/sql/vdbemem.c | 20 +++++++++++++
 2 files changed, 66 insertions(+), 23 deletions(-)

diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
index dd8163f5e..b4293d961 100644
--- a/src/box/sql/sqlInt.h
+++ b/src/box/sql/sqlInt.h
@@ -4151,31 +4151,54 @@ sql_expr_new_column(struct sql *db, struct SrcList *src_list, int src_idx,
 
 int sqlExprCheckIN(Parse *, Expr *);
 
-int sqlStat4ProbeSetValue(Parse *, struct index_def *, UnpackedRecord **, Expr *, int,
-			      int, int *);
-int sqlStat4ValueFromExpr(Parse *, Expr *, enum field_type type,
-			      sql_value **);
-void sqlStat4ProbeFree(UnpackedRecord *);
+/* TODO: Enable this function when stat-tables will be revived. */
+static inline int
+sqlStat4ProbeSetValue(struct Parse *parse, struct index_def *def,
+		      struct UnpackedRecord **rec, struct Expr *expr, int n,
+		      int i, int *out)
+{
+	(void)parse;
+	(void)def;
+	(void)rec;
+	(void)expr;
+	(void)n;
+	(void)i;
+	(void)out;
+	unreachable();
+	return 0;
+}
 
-/**
- * Extract the col_num-th column from the record.  Write
- * the column value into *res.  If *res is initially NULL
- * then a new sql_value object is allocated.
- *
- * If *res is initially NULL then the caller is responsible for
- * ensuring that the value written into *res is eventually
- * freed.
- *
- * @param db Database handle.
- * @param record Pointer to buffer containing record.
- * @param col_num Column to extract.
- * @param[out] res Extracted value.
- *
- * @retval -1 on error or 0.
- */
-int
+/* TODO: Enable this function when stat-tables will be revived. */
+static inline int
+sqlStat4ValueFromExpr(struct Parse *parse, struct Expr *expr,
+		      enum field_type type, struct Mem **mem)
+{
+	(void)parse;
+	(void)expr;
+	(void)type;
+	(void)mem;
+	unreachable();
+	return 0;
+}
+
+/* TODO: Enable this function when stat-tables will be revived. */
+static inline void
+sqlStat4ProbeFree(struct UnpackedRecord *rec)
+{
+	(void)rec;
+}
+
+/* TODO: Enable this function when stat-tables will be revived. */
+static inline int
 sql_stat4_column(struct sql *db, const char *record, uint32_t col_num,
-		 sql_value **res);
+		 struct Mem **res)
+{
+	(void)db;
+	(void)record;
+	(void)col_num;
+	(void)res;
+	return 0;
+}
 
 /*
  * The interface to the LEMON-generated parser
diff --git a/src/box/sql/vdbemem.c b/src/box/sql/vdbemem.c
index 85d620a0a..263fe5b00 100644
--- a/src/box/sql/vdbemem.c
+++ b/src/box/sql/vdbemem.c
@@ -44,6 +44,8 @@
 #include "box/tuple.h"
 #include "mpstream/mpstream.h"
 
+#if 0
+
 /*
  * Context object passed by sqlStat4ProbeSetValue() through to
  * valueNew(). See comments above valueNew() for details.
@@ -523,6 +525,22 @@ sqlStat4ValueFromExpr(Parse * pParse,	/* Parse context */
 	return stat4ValueFromExpr(pParse, pExpr, type, 0, ppVal);
 }
 
+/**
+ * Extract the col_num-th column from the record.  Write
+ * the column value into *res.  If *res is initially NULL
+ * then a new sql_value object is allocated.
+ *
+ * If *res is initially NULL then the caller is responsible for
+ * ensuring that the value written into *res is eventually
+ * freed.
+ *
+ * @param db Database handle.
+ * @param record Pointer to buffer containing record.
+ * @param col_num Column to extract.
+ * @param[out] res Extracted value.
+ *
+ * @retval -1 on error or 0.
+ */
 int
 sql_stat4_column(struct sql *db, const char *record, uint32_t col_num,
 		 sql_value **res)
@@ -565,3 +583,5 @@ sqlStat4ProbeFree(UnpackedRecord * pRec)
 		sqlDbFree(aMem[0].db, pRec);
 	}
 }
+
+#endif
-- 
2.25.1



More information about the Tarantool-patches mailing list