Commit e0c3bda7 authored by unknown's avatar unknown

Merge mysql.com:/opt/local/work/mysql-4.1-12734

into  mysql.com:/opt/local/work/mysql-5.0-root


sql/item_cmpfunc.cc:
  Auto merged
mysql-test/r/ps.result:
  Manual merge
mysql-test/t/ps.test:
  Manual merge
sql/item_cmpfunc.h:
  Manual merge
parents fdf99831 04a78106
...@@ -870,6 +870,36 @@ drop table t1; ...@@ -870,6 +870,36 @@ drop table t1;
set names default; set names default;
deallocate prepare stmt; deallocate prepare stmt;
#
# A test case for Bug#12734 "prepared statement may return incorrect result
# set for a select SQL request": test that canDoTurboBM is reset for each
# execute of a prepared statement.
#
create table t1 (
word_id mediumint(8) unsigned not null default '0',
formatted varchar(20) not null default ''
);
insert into t1 values
(80,'pendant'), (475,'pretendants'), (989,'tendances'),
(1019,'cependant'),(1022,'abondance'),(1205,'independants'),
(13,'lessiver'),(25,'lambiner'),(46,'situer'),(71,'terminer'),
(82,'decrocher');
select count(*) from t1 where formatted like '%NDAN%';
select count(*) from t1 where formatted like '%ER';
prepare stmt from "select count(*) from t1 where formatted like ?";
set @like="%NDAN%";
execute stmt using @like;
set @like="%ER";
execute stmt using @like;
set @like="%NDAN%";
execute stmt using @like;
set @like="%ER";
execute stmt using @like;
deallocate prepare stmt;
drop table t1;
# End of 4.1 tests # End of 4.1 tests
# #
......
...@@ -3059,6 +3059,12 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref) ...@@ -3059,6 +3059,12 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref)
return FALSE; return FALSE;
} }
void Item_func_like::cleanup()
{
canDoTurboBM= FALSE;
Item_bool_func2::cleanup();
}
#ifdef USE_REGEX #ifdef USE_REGEX
bool bool
......
...@@ -1001,6 +1001,7 @@ public: ...@@ -1001,6 +1001,7 @@ public:
cond_result eq_cmp_result() const { return COND_TRUE; } cond_result eq_cmp_result() const { return COND_TRUE; }
const char *func_name() const { return "like"; } const char *func_name() const { return "like"; }
bool fix_fields(THD *thd, Item **ref); bool fix_fields(THD *thd, Item **ref);
void cleanup();
}; };
#ifdef USE_REGEX #ifdef USE_REGEX
......
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