Below is the list of changes that have just been committed into a local
5.0 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, 2006-12-16 00:49:08+03:00, evgen@stripped +4 -0
Bug#23409: Arguments of the ENCODE() and the DECODE() functions wasn't 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. This
leads to those objects being wrongly printed and all view using these
functions are being erroneous.
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/view.result@stripped, 2006-12-16 00:47:37+03:00, evgen@stripped +22 -0
Added a test case for bug#23409: Arguments of the ENCODE() and the DECODE() functions wasn't printed correctly.
mysql-test/t/view.test@stripped, 2006-12-16 00:47:35+03:00, evgen@stripped +14 -0
Added a test case for bug#23409: Arguments of the ENCODE() and the DECODE() functions wasn't printed
correctly.
sql/item_strfunc.cc@stripped, 2006-12-16 00:48:21+03:00, evgen@stripped +13 -0
Bug#23409: Arguments of the ENCODE() and the DECODE() functions wasn't 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, 2006-12-16 00:47:39+03:00, evgen@stripped +5 -3
Bug#23409: Arguments of the ENCODE() and the DECODE() functions wasn't 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-5.0-opt-mysql
--- 1.290/sql/item_strfunc.cc 2006-12-01 15:02:50 +03:00
+++ 1.291/sql/item_strfunc.cc 2006-12-16 00:48:21 +03:00
@@ -1694,6 +1694,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.118/sql/item_strfunc.h 2006-11-16 14:06:48 +03:00
+++ 1.119/sql/item_strfunc.h 2006-12-16 00:47:39 +03:00
@@ -359,19 +359,21 @@
{
protected:
SQL_CRYPT sql_crypt;
+ char *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(seed_arg) {}
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.184/mysql-test/r/view.result 2006-11-03 01:34:16 +03:00
+++ 1.185/mysql-test/r/view.result 2006-12-16 00:47:37 +03:00
@@ -3014,4 +3014,26 @@
6 3
DROP VIEW v1, v2;
DROP TABLE t1;
+create table t1(f1 varchar(4));
+insert into t1 values('asdf'),('qwer');
+create view v1 as select encode(f1,'zxcv') as 'enc' from t1;
+show fields from v1;
+Field Type Null Key Default Extra
+enc varbinary(4) YES NULL
+create view v2 as select decode(enc,'zxcv') as 'dec' from v1;
+show fields from v2;
+Field Type Null Key Default Extra
+dec varbinary(4) YES NULL
+select * from v2;
+dec
+asdf
+qwer
+show create view v1;
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select encode(`t1`.`f1`,'zxcv') AS `enc` from `t1`
+show create view v2;
+View Create View
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select decode(`v1`.`enc`,'zxcv') AS `dec` from `v1`
+drop view v1,v2;
+drop table t1;
End of 5.0 tests.
--- 1.170/mysql-test/t/view.test 2006-11-03 01:34:16 +03:00
+++ 1.171/mysql-test/t/view.test 2006-12-16 00:47:35 +03:00
@@ -2959,5 +2959,19 @@
DROP VIEW v1, v2;
DROP TABLE t1;
+#
+# Bug#23409: ENCODE() and DECODE() functions aren't printed correctly
+#
+create table t1(f1 varchar(4));
+insert into t1 values('asdf'),('qwer');
+create view v1 as select encode(f1,'zxcv') as 'enc' from t1;
+show fields from v1;
+create view v2 as select decode(enc,'zxcv') as 'dec' from v1;
+show fields from v2;
+select * from v2;
+show create view v1;
+show create view v2;
+drop view v1,v2;
+drop table t1;
--echo End of 5.0 tests.
| Thread |
|---|
| • bk commit into 5.0 tree (evgen:1.2349) BUG#23409 | eugene | 16 Dec |