Commit 653a56fd authored by Kentoku SHIBA's avatar Kentoku SHIBA Committed by GitHub

MDEV-17508 Fix bug for spider when using "not like" (#1282)

parent 645f77a6
......@@ -4864,9 +4864,10 @@ int spider_db_mbase_util::open_item_func(
}
break;
case Item_func::LIKE_FUNC:
#ifdef SPIDER_LIKE_FUNC_HAS_GET_NEGATED
if (str)
{
if (((Item_func_like *)item_func)->negated)
if (((Item_func_like *)item_func)->get_negated())
{
func_name = SPIDER_SQL_NOT_LIKE_STR;
func_name_length = SPIDER_SQL_NOT_LIKE_LEN;
......@@ -4878,6 +4879,9 @@ int spider_db_mbase_util::open_item_func(
}
}
break;
#else
DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
#endif
default:
THD *thd = spider->trx->thd;
SPIDER_SHARE *share = spider->share;
......
......@@ -4043,13 +4043,31 @@ int spider_db_oracle_util::open_item_func(
case Item_func::LE_FUNC:
case Item_func::GE_FUNC:
case Item_func::GT_FUNC:
case Item_func::LIKE_FUNC:
if (str)
{
func_name = (char*) item_func->func_name();
func_name_length = strlen(func_name);
}
break;
case Item_func::LIKE_FUNC:
#ifdef SPIDER_LIKE_FUNC_HAS_GET_NEGATED
if (str)
{
if (((Item_func_like *)item_func)->get_negated())
{
func_name = SPIDER_SQL_NOT_LIKE_STR;
func_name_length = SPIDER_SQL_NOT_LIKE_LEN;
}
else
{
func_name = (char*)item_func->func_name();
func_name_length = strlen(func_name);
}
}
break;
#else
DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
#endif
default:
THD *thd = spider->trx->thd;
SPIDER_SHARE *share = spider->share;
......
......@@ -50,5 +50,6 @@
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100400
#define SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM
#define SPIDER_SQL_CACHE_IS_IN_LEX
#define SPIDER_LIKE_FUNC_HAS_GET_NEGATED
#endif
#endif /* SPD_ENVIRON_INCLUDED */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment