List:Commits« Previous MessageNext Message »
From:eugene Date:January 11 2007 2:45pm
Subject:bk commit into 4.1 tree (evgen:1.2596) BUG#23409
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of evgen. When evgen 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@stripped, 2007-01-11 16:45:38+03:00, evgen@stripped +4 -0
  Bug#23409: Arguments of the ENCODE() and the DECODE() functions were not printed
  correctly.
  
  The Item_func::print method was used to print the Item_func_encode and the
  Item_func_decode objects. The last argument to ENCODE and DECODE functions
  is a plain C string and thus Item_func::print wasn't able to print it.
  
  The print() method is added to the Item_func_encode class. It correctly
  prints the Item_func_encode and the Item_func_decode objects.

  mysql-test/r/func_str.result@stripped, 2007-01-11 16:43:01+03:00, evgen@stripped +13 -1
    Added a test case for bug#23409: Arguments of the ENCODE() and the DECODE() functions were not printed correctly.

  mysql-test/t/func_str.test@stripped, 2007-01-11 16:42:29+03:00, evgen@stripped +8 -0
    Added a test case for bug#23409: Arguments of the ENCODE() and the
    > DECODE() functionswere not printed correctly.

  sql/item_strfunc.cc@stripped, 2007-01-11 16:44:59+03:00, evgen@stripped +13 -0
    Bug#23409: Arguments of the ENCODE() and the DECODE() functions were not printed correctly.
    The print() method is added to the Item_func_encode class. It correctly
    prints the Item_func_encode and the Item_func_decode objects.

  sql/item_strfunc.h@stripped, 2007-01-11 16:44:43+03:00, evgen@stripped +8 -3
    Bug#23409: Arguments of the ENCODE() and the DECODE() functions were not printed correctly.
    The print() method is added to the Item_func_encode class.

# 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:	evgen
# Host:	moonbone.local
# Root:	/work/23409-bug-4.1-opt-mysql

--- 1.252/sql/item_strfunc.cc	2006-10-13 18:05:52 +04:00
+++ 1.253/sql/item_strfunc.cc	2007-01-11 16:44:59 +03:00
@@ -1583,6 +1583,19 @@
   return res;
 }
 
+void Item_func_encode::print(String *str)
+{
+  str->append(func_name());
+  str->append('(');
+  args[0]->print(str);
+  str->append(',');
+  str->append('\'');
+  str->append(seed);
+  str->append('\'');
+  str->append(')');
+}
+
+
 String *Item_func_decode::val_str(String *str)
 {
   DBUG_ASSERT(fixed == 1);

--- 1.104/sql/item_strfunc.h	2006-08-24 02:30:02 +04:00
+++ 1.105/sql/item_strfunc.h	2007-01-11 16:44:43 +03:00
@@ -343,19 +343,24 @@
 {
  protected:
   SQL_CRYPT sql_crypt;
+  String seed;
 public:
-  Item_func_encode(Item *a, char *seed):
-    Item_str_func(a),sql_crypt(seed) {}
+  Item_func_encode(Item *a, char *seed_arg):
+    Item_str_func(a), sql_crypt(seed_arg)
+    {
+      seed.copy(seed_arg, strlen(seed_arg), default_charset_info);
+    }
   String *val_str(String *);
   void fix_length_and_dec();
   const char *func_name() const { return "encode"; }
+  void print(String *str);
 };
 
 
 class Item_func_decode :public Item_func_encode
 {
 public:
-  Item_func_decode(Item *a, char *seed): Item_func_encode(a,seed) {}
+  Item_func_decode(Item *a, char *seed_arg): Item_func_encode(a, seed_arg) {}
   String *val_str(String *);
   const char *func_name() const { return "decode"; }
 };

--- 1.103/mysql-test/r/func_str.result	2006-07-19 23:36:54 +04:00
+++ 1.104/mysql-test/r/func_str.result	2007-01-11 16:43:01 +03:00
@@ -806,7 +806,7 @@
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
 Warnings:
-Note	1003	select md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,cast(_latin1'HE' as char charset binary) AS `b
 inary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate _latin1'latin1_bin'),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n	\r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n	\r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n	\r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS
  `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substr_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")`
+Note	1003	select md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,cast(_latin1'HE' as char charset binary) AS `b
 inary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate _latin1'latin1_bin'),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n	\r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n	\r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n	\r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS
  `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substr_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000),'monty'),'monty') AS `decode(encode(repeat("a",100000),"monty"),"monty")`
 SELECT lpad(12345, 5, "#");
 lpad(12345, 5, "#")
 12345
@@ -1064,4 +1064,16 @@
 Warnings:
 Note	1003	select test.t1.s AS `s` from test.t1 where (trim(both _latin1'y' from test.t1.s) > _latin1'ab')
 DROP TABLE t1;
+create table t1(f1 varchar(4));
+explain extended select encode(f1,'zxcv') as 'enc' from t1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	system	NULL	NULL	NULL	NULL	0	const row not found
+Warnings:
+Note	1003	select encode(test.t1.f1,'zxcv') AS `enc` from test.t1
+explain extended select decode(f1,'zxcv') as 'enc' from t1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	system	NULL	NULL	NULL	NULL	0	const row not found
+Warnings:
+Note	1003	select decode(test.t1.f1,'zxcv') AS `enc` from test.t1
+drop table t1;
 End of 4.1 tests

--- 1.85/mysql-test/t/func_str.test	2006-07-19 23:36:54 +04:00
+++ 1.86/mysql-test/t/func_str.test	2007-01-11 16:42:29 +03:00
@@ -713,4 +713,12 @@
 
 DROP TABLE t1;
  
+#
+# Bug#23409: ENCODE() and DECODE() functions aren't printed correctly
+#
+create table t1(f1 varchar(4));
+explain extended select encode(f1,'zxcv') as 'enc' from t1;
+explain extended select decode(f1,'zxcv') as 'enc' from t1;
+drop table t1;
+
 --echo End of 4.1 tests
Thread
bk commit into 4.1 tree (evgen:1.2596) BUG#23409eugene11 Jan