List:Commits« Previous MessageNext Message »
From:ramil Date:June 13 2006 11:01am
Subject:bk commit into 4.0 tree (ramil:1.2182) BUG#12728
View as plain text  
Below is the list of changes that have just been committed into a local
4.0 repository of ram. When ram does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2182 06/06/13 16:01:54 ramil@stripped +4 -0
  Fix for bug #12728: Very strange behaviour of ELT

  sql/item_strfunc.h
    1.27 06/06/13 16:01:50 ramil@stripped +1 -0
    Fix for bug #12728: Very strange behaviour of ELT
      - Item_func_elt::eq() introduced: check 'item' member as well
        (to distinguish for instance elt(1, 'a', 'b') and elt(2, 'a', 'b')

  sql/item_strfunc.cc
    1.87 06/06/13 16:01:50 ramil@stripped +11 -0
    Fix for bug #12728: Very strange behaviour of ELT
      - Item_func_elt::eq() introduced: check 'item' member as well
        (to distinguish for instance elt(1, 'a', 'b') and elt(2, 'a', 'b')

  mysql-test/t/func_str.test
    1.35 06/06/13 16:01:50 ramil@stripped +8 -0
    Fix for bug #12728: Very strange behaviour of ELT
      - test result

  mysql-test/r/func_str.result
    1.35 06/06/13 16:01:50 ramil@stripped +7 -0
    Fix for bug #12728: Very strange behaviour of ELT
      - test case

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	ramil
# Host:	myoffice.izhnet.ru
# Root:	/usr/home/ram/work/4.0.b12728

--- 1.86/sql/item_strfunc.cc	2005-08-01 09:28:43 +05:00
+++ 1.87/sql/item_strfunc.cc	2006-06-13 16:01:50 +05:00
@@ -1599,6 +1599,17 @@ String *Item_func_elt::val_str(String *s
 }
 
 
+bool Item_func_elt::eq(const Item *par_item, bool binary_cmp) const
+{
+  /* 
+    We can use (Item_func_elt*) typecast here because the check is done 
+    in the Item_func::eq().
+  */
+  return Item_func::eq(par_item, binary_cmp) &&
+         item->eq(((Item_func_elt*) par_item)->item, binary_cmp);
+}
+
+
 void Item_func_make_set::split_sum_func(List<Item> &fields)
 {
   if (item->with_sum_func && item->type() != SUM_FUNC_ITEM)

--- 1.26/sql/item_strfunc.h	2005-02-02 06:22:32 +04:00
+++ 1.27/sql/item_strfunc.h	2006-06-13 16:01:50 +05:00
@@ -372,6 +372,7 @@ public:
   void fix_length_and_dec();
   void update_used_tables();
   const char *func_name() const { return "elt"; }
+  bool eq(const Item *par_item, bool binary_cmp) const;
   unsigned int size_of() { return sizeof(*this);}  
 };
 

--- 1.34/mysql-test/r/func_str.result	2005-08-01 09:28:43 +05:00
+++ 1.35/mysql-test/r/func_str.result	2006-06-13 16:01:50 +05:00
@@ -436,3 +436,10 @@ id	aes_decrypt(str, 'bar')
 1	foo
 2	NULL
 DROP TABLE t1, t2;
+create table t1(a varchar(8), primary key(a));
+insert into t1 values('bar'), ('foo');
+select a from t1 where a=elt(1, 'foo', 'bar') or a=elt(2, 'foo', 'bar');
+a
+bar
+foo
+drop table t1;

--- 1.34/mysql-test/t/func_str.test	2005-08-01 09:28:43 +05:00
+++ 1.35/mysql-test/t/func_str.test	2006-06-13 16:01:50 +05:00
@@ -254,3 +254,11 @@ SELECT t1.id, aes_decrypt(str, 'bar') FR
 
 DROP TABLE t1, t2;
 
+#
+# Bug #12728: strange elt() behavior
+#
+
+create table t1(a varchar(8), primary key(a));
+insert into t1 values('bar'), ('foo');
+select a from t1 where a=elt(1, 'foo', 'bar') or a=elt(2, 'foo', 'bar');
+drop table t1;
Thread
bk commit into 4.0 tree (ramil:1.2182) BUG#12728ramil13 Jun