1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-17508 Fix bug for spider when using "not like"

fix bug for spider where using "not like" (#890)

test case:
t1 is a spider engine table;
  CREATE TABLE `t1` (
  `id` int(11) NOT NULL DEFAULT '0',
  `name` char(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=SPIDER

query: "select * from t1 where name  not like 'x%' " would dispatch "select xxx name name like 'x%' " to remote mysqld, is wrong
This commit is contained in:
willhan
2019-04-16 22:10:05 +08:00
committed by Sergei Golubchik
parent d30e51fafb
commit 3551cd32a8
5 changed files with 219 additions and 2 deletions

View File

@@ -3948,13 +3948,27 @@ int spider_db_mysql_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:
if (str)
{
if (((Item_func_like *)item_func)->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;
default:
THD *thd = spider->trx->thd;
SPIDER_SHARE *share = spider->share;