Commit 12499342 authored by unknown's avatar unknown

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


mysql-test/r/ps.result:
  eq() for parameters test
mysql-test/t/ps.test:
  eq() for parameters test
sql/item.h:
  correct eq() method for Item_param
parent f7b6cafb
......@@ -191,4 +191,21 @@ execute stmt1 using @arg00;
select m from t1;
m
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;
......@@ -178,4 +178,19 @@ drop table t1;
prepare stmt1 from ' create table t1 (m int) as select ? as m ' ;
execute stmt1 using @arg00;
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;
......@@ -525,6 +525,8 @@ class Item_param :public Item
virtual table_map used_tables() const
{ return state != NO_VALUE ? (table_map)0 : PARAM_TABLE_BIT; }
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
......
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