summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorserg@serg.mylan <>2004-06-26 23:55:38 +0200
committerserg@serg.mylan <>2004-06-26 23:55:38 +0200
commita5c8b3ee59c25db5d042a828bccd5a1f5343b919 (patch)
tree8d9a3160afdc652d71f8de3634d8def919a020cc
parentc4004aec8aaadb1bd775eb9a5ede8359debe083e (diff)
downloadmariadb-git-a5c8b3ee59c25db5d042a828bccd5a1f5343b919.tar.gz
correct eq() method for Item_param (BUG#4233)
-rw-r--r--mysql-test/r/ps.result17
-rw-r--r--mysql-test/t/ps.test15
-rw-r--r--sql/item.h2
3 files changed, 34 insertions, 0 deletions
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index de20f102b07..897e2c495b3 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -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;
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 5af65242e7b..a3232fb15e9 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -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;
diff --git a/sql/item.h b/sql/item.h
index 235b15c56fc..70663546880 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -525,6 +525,8 @@ public:
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