[tarantool-patches] [PATCH v3 6/9] sql: remove SQL_FUNC_SLOCHNG flag
Kirill Shcherbatov
kshcherbatov at tarantool.org
Fri Aug 16 16:26:52 MSK 2019
The SQL_FUNC_SLOCHNG flag was useful for datetime function
that are currently not supported. So it could be removed.
Needed for #2200, #4113, #2233
---
src/box/sql/sqlInt.h | 15 +--------------
src/box/sql/resolve.c | 4 +---
src/box/sql/vdbemem.c | 6 ++----
3 files changed, 4 insertions(+), 21 deletions(-)
diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
index bc3c639e6..5a3e8f1c1 100644
--- a/src/box/sql/sqlInt.h
+++ b/src/box/sql/sqlInt.h
@@ -1318,9 +1318,7 @@ struct FuncDestructor {
#define SQL_FUNC_UNLIKELY 0x0400 /* Built-in unlikely() function */
#define SQL_FUNC_CONSTANT 0x0800 /* Constant inputs give a constant output */
#define SQL_FUNC_MINMAX 0x1000 /* True for min() and max() aggregates */
-#define SQL_FUNC_SLOCHNG 0x2000 /* "Slow Change". Value constant during a
- * single query - might change over time
- */
+
/**
* If function returns string, it may require collation to be
* applied on its result. For instance, result of substr()
@@ -1359,11 +1357,6 @@ enum trim_side_mask {
* VFUNCTION(zName, nArg, iArg, bNC, xFunc)
* Like FUNCTION except it omits the sql_FUNC_CONSTANT flag.
*
- * DFUNCTION(zName, nArg, iArg, bNC, xFunc)
- * Like FUNCTION except it omits the sql_FUNC_CONSTANT flag and
- * adds the sql_FUNC_SLOCHNG flag. Used for date & time functions,
- * but not during a single query.
- *
* AGGREGATE(zName, nArg, iArg, bNC, xStep, xFinal)
* Used to create an aggregate function definition implemented by
* the C functions xStep and xFinal. The first four parameters
@@ -1387,15 +1380,9 @@ enum trim_side_mask {
#define VFUNCTION(zName, nArg, iArg, bNC, xFunc, type) \
{nArg, (bNC*SQL_FUNC_NEEDCOLL), \
SQL_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0}, type}
-#define DFUNCTION(zName, nArg, iArg, bNC, xFunc, type) \
- {nArg, SQL_FUNC_SLOCHNG|(bNC*SQL_FUNC_NEEDCOLL), \
- SQL_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0}, type}
#define FUNCTION2(zName, nArg, iArg, bNC, xFunc, extraFlags, type) \
{nArg,SQL_FUNC_CONSTANT|(bNC*SQL_FUNC_NEEDCOLL)|extraFlags,\
SQL_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0}, type}
-#define STR_FUNCTION(zName, nArg, pArg, bNC, xFunc) \
- {nArg, SQL_FUNC_SLOCHNG|(bNC*SQL_FUNC_NEEDCOLL), \
- pArg, 0, xFunc, 0, #zName, {SQL_AFF_STRING, {0}}}
#define LIKEFUNC(zName, nArg, arg, flags, type) \
{nArg, SQL_FUNC_NEEDCOLL|SQL_FUNC_CONSTANT|flags, \
(void *)(SQL_INT_TO_PTR(arg)), 0, likeFunc, 0, #zName, {0}, type}
diff --git a/src/box/sql/resolve.c b/src/box/sql/resolve.c
index 0b90edd06..207f57ba6 100644
--- a/src/box/sql/resolve.c
+++ b/src/box/sql/resolve.c
@@ -647,9 +647,7 @@ resolveExprStep(Walker * pWalker, Expr * pExpr)
'u' ? 8388608 : 125829120;
}
}
- if (pDef->
- funcFlags & (SQL_FUNC_CONSTANT |
- SQL_FUNC_SLOCHNG)) {
+ if ((pDef->funcFlags & SQL_FUNC_CONSTANT) != 0) {
/* For the purposes of the EP_ConstFunc flag, date and time
* functions and other functions that change slowly are considered
* constant because they are constant for the duration of one query
diff --git a/src/box/sql/vdbemem.c b/src/box/sql/vdbemem.c
index b8c31ecec..5516d7fb1 100644
--- a/src/box/sql/vdbemem.c
+++ b/src/box/sql/vdbemem.c
@@ -1302,11 +1302,9 @@ valueFromFunction(sql * db, /* The database connection */
nVal = pList->nExpr;
pFunc = sqlFindFunction(db, p->u.zToken, nVal, 0);
assert(pFunc);
- if ((pFunc->funcFlags & (SQL_FUNC_CONSTANT | SQL_FUNC_SLOCHNG)) ==
- 0 || (pFunc->funcFlags & SQL_FUNC_NEEDCOLL)
- ) {
+ if ((pFunc->funcFlags & SQL_FUNC_CONSTANT) == 0 ||
+ (pFunc->funcFlags & SQL_FUNC_NEEDCOLL))
return 0;
- }
if (pList) {
apVal =
--
2.22.1
More information about the Tarantool-patches
mailing list