3316 Davi Arnaut 2011-07-29
WL#2111: #10 Use default collation utf8_general_ci
Since MySQL's default collation for the UTF8 character set
is utf8_general_ci, also use it as the default collation for
the UTF8 string-based diagnostics items.
@ mysql-test/t/get_diagnostics.test
Print the default character set, collation and collation
coercibility of some of the UTF8 string-base items.
@ sql/sql_get_diagnostics.cc
The destination character set is UTF8 with utf8_general_ci
collation.
modified:
mysql-test/r/get_diagnostics.result
mysql-test/t/get_diagnostics.test
sql/sql_get_diagnostics.cc
3315 Davi Arnaut 2011-07-27
WL#2111: #9 GET DIAGNOSTICS should not reset the value of ROW_COUNT
Ensure that GET DIAGNOSTICS does not interfere with the value of
ROW_COUNT. Also, fix the "Invalid condition number" error message
to not end with a dot.
@ mysql-test/t/get_diagnostics.test
Test that GET DIAGNOSTICS does not reset ROW_COUNT
@ sql/share/errmsg-utf8.txt
It's unusual for English messages to end with ".",
and the standard message for SQLSTATE='35000' is
"Invalid condition number" without a ".".
@ sql/sql_get_diagnostics.cc
Since my_ok() sets the value of the ROW_COUNT function, set
the diagnostics area status directly as to avoid interfering
with the value of the ROW_COUNT function.
modified:
mysql-test/r/get_diagnostics.result
mysql-test/t/get_diagnostics.test
sql/share/errmsg-utf8.txt
sql/sql_get_diagnostics.cc
=== modified file 'mysql-test/r/get_diagnostics.result'
--- a/mysql-test/r/get_diagnostics.result 2011-07-27 21:57:33 +0000
+++ b/mysql-test/r/get_diagnostics.result 2011-07-29 10:22:38 +0000
@@ -784,6 +784,21 @@ SELECT @var1, @var2;
@var1 @var2
1 1
DROP TABLE t1;
+
+# Items are UTF8 (utf8_general_ci default collation)
+
+SELECT CAST(-19999999999999999999 AS SIGNED);
+CAST(-19999999999999999999 AS SIGNED)
+-9223372036854775808
+Warnings:
+Warning 1292 Truncated incorrect DECIMAL value: ''
+GET DIAGNOSTICS CONDITION 1 @var1 = MESSAGE_TEXT, @var2 = CLASS_ORIGIN;
+SELECT CHARSET(@var1), COLLATION(@var1), COERCIBILITY(@var1);
+CHARSET(@var1) COLLATION(@var1) COERCIBILITY(@var1)
+utf8 utf8_general_ci 2
+SELECT CHARSET(@var2), COLLATION(@var2), COERCIBILITY(@var2);
+CHARSET(@var2) COLLATION(@var2) COERCIBILITY(@var2)
+utf8 utf8_general_ci 2
#
# Command statistics
#
=== modified file 'mysql-test/t/get_diagnostics.test'
--- a/mysql-test/t/get_diagnostics.test 2011-07-27 21:57:33 +0000
+++ b/mysql-test/t/get_diagnostics.test 2011-07-29 10:22:38 +0000
@@ -850,6 +850,15 @@ GET DIAGNOSTICS @var2 = ROW_COUNT;
SELECT @var1, @var2;
DROP TABLE t1;
+--echo
+--echo # Items are UTF8 (utf8_general_ci default collation)
+--echo
+
+SELECT CAST(-19999999999999999999 AS SIGNED);
+GET DIAGNOSTICS CONDITION 1 @var1 = MESSAGE_TEXT, @var2 = CLASS_ORIGIN;
+SELECT CHARSET(@var1), COLLATION(@var1), COERCIBILITY(@var1);
+SELECT CHARSET(@var2), COLLATION(@var2), COERCIBILITY(@var2);
+
--echo #
--echo # Command statistics
--echo #
=== modified file 'sql/sql_get_diagnostics.cc'
--- a/sql/sql_get_diagnostics.cc 2011-07-27 21:57:33 +0000
+++ b/sql/sql_get_diagnostics.cc 2011-07-29 10:22:38 +0000
@@ -266,11 +266,13 @@ Condition_information::aggregate(THD *th
Item *
Condition_information_item::make_utf8_string_item(THD *thd, const String *str)
{
+ /* Default is utf8 character set and utf8_general_ci collation. */
+ const CHARSET_INFO *to_cs= &my_charset_utf8_general_ci;
/* If a charset was not set, assume that no conversion is needed. */
- const CHARSET_INFO *cs= str->charset() ? str->charset() : &my_charset_utf8_bin;
- Item_string *item= new Item_string(str->ptr(), str->length(), cs);
+ const CHARSET_INFO *from_cs= str->charset() ? str->charset() : to_cs;
+ Item_string *item= new Item_string(str->ptr(), str->length(), from_cs);
/* If necessary, convert the string (ignoring errors), then copy it over. */
- return item ? item->charset_converter(&my_charset_utf8_bin, false) : NULL;
+ return item ? item->charset_converter(to_cs, false) : NULL;
}
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (davi:3315 to 3316) WL#2111 | Davi Arnaut | 3 Aug |