Commit a5c8b3ee authored by serg@serg.mylan's avatar serg@serg.mylan

correct eq() method for Item_param (BUG#4233)

parent c4004aec
...@@ -191,4 +191,21 @@ execute stmt1 using @arg00; ...@@ -191,4 +191,21 @@ execute stmt1 using @arg00;
select m from t1; select m from t1;
m m
1 1
deallocate prepare stmt1;
drop table t1;
create table t1 (id int(10) unsigned NOT NULL default '0',
name varchar(64) NOT NULL default '',
PRIMARY KEY (id), UNIQUE KEY `name` (`name`));
insert into t1 values (1,'1'),(2,'2'),(3,'3'),(4,'4'),(5,'5'),(6,'6'),(7,'7');
prepare stmt1 from 'select name from t1 where id=? or id=?';
set @id1=1,@id2=6;
execute stmt1 using @id1, @id2;
name
1
6
select name from t1 where id=1 or id=6;
name
1
6
deallocate prepare stmt1;
drop table t1; drop table t1;
...@@ -178,4 +178,19 @@ drop table t1; ...@@ -178,4 +178,19 @@ drop table t1;
prepare stmt1 from ' create table t1 (m int) as select ? as m ' ; prepare stmt1 from ' create table t1 (m int) as select ? as m ' ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
select m from t1; select m from t1;
deallocate prepare stmt1;
drop table t1;
#
# eq() for parameters
#
create table t1 (id int(10) unsigned NOT NULL default '0',
name varchar(64) NOT NULL default '',
PRIMARY KEY (id), UNIQUE KEY `name` (`name`));
insert into t1 values (1,'1'),(2,'2'),(3,'3'),(4,'4'),(5,'5'),(6,'6'),(7,'7');
prepare stmt1 from 'select name from t1 where id=? or id=?';
set @id1=1,@id2=6;
execute stmt1 using @id1, @id2;
select name from t1 where id=1 or id=6;
deallocate prepare stmt1;
drop table t1; drop table t1;
...@@ -525,6 +525,8 @@ public: ...@@ -525,6 +525,8 @@ public:
virtual table_map used_tables() const virtual table_map used_tables() const
{ return state != NO_VALUE ? (table_map)0 : PARAM_TABLE_BIT; } { return state != NO_VALUE ? (table_map)0 : PARAM_TABLE_BIT; }
void print(String *str) { str->append('?'); } void print(String *str) { str->append('?'); }
/* parameter never equal to other parameter of other item */
bool eq(const Item *item, bool binary_cmp) const { return 0; }
}; };
class Item_int :public Item_num class Item_int :public Item_num
......
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