Hello Øystein,
Please find a new version of WL#2649 patch here:
http://lists.mysql.com/commits/81141
I fully rewrote it since the previous version,
and it is much smaller now.
The new code change patch (i.e. without tests) is
98Kb in size and touches 20 source files
vs the old version which was
170 Kb and modified 29 files.
What was changed since the previous version:
DIFFERENCE 1
============
Now I don't force Items to return @@character_set_connection
in many cases.
For example:
- Numeric constants: Item_int, Item_decimal, Item_float
- Real, Integer and boolean functions, numeric operators
(like +, -, *, /) and others.
- DECIMAL, DATE, TIME, DATETIME type cast
don't return @@character_set_connection.
They return latin1 instead. This allowed to stay
in 8-bit implementation without having to rewrite
items to support multi-byte character sets results (e.g. UCS2).
Basically the change for these items is to use latin1 instead
of my_charset_bin.
DIFFERENCE 2
============
According to the WL description, string functions
with numeric input must return a string using
@@character_set_connection.
For example:
SET character_set_connection=ucs2;
CREATE TABLE t1 AS SELECT concat(1); -- must create an UCS2 column
To make this work, I fixed all string functions
to make a special step when aggregating arguments:
if ALL arguments are non-string (numeric, date/time types),
then the string functions force conversion of the arguments to
@@character_set_connection.
For example:
SET character_set_connection=ucs2;
CREATE TABLE t1 AS SELECT concat(1, 2, 3);
will actually work as:
SET character_set_connection=ucs2;
CREATE TABLE t1 AS SELECT
concat(
CONVERT(1 USING ucs2),
CONVERT(2 USING ucs2)
CONVERT(3 USING ucs2));
From the user point of view
===========================
The previous version and the new version look the same for users.
- Various CREATE TABLE involving number-to-string conversion
create exactly the same results.
- User will see exactly the same metadata on the client side,
because results are converted to @@character_set_results anyway.
Can you please review the new version?
Thank you very much.