Below is the list of changes that have just been committed into a local
5.0 repository of bar. When bar 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.1960 05/09/16 10:24:37 bar@stripped +5 -0
Bug#10504
Character set does not support traditional mode
ctype_utf8.result, ctype_utf8.test:
adding test case.
password.c, mysql_com.h
Changeing octet2hex availability from static to public.
item_strfunc.cc:
Result string is now checked to be well-formed.
Warning/error is generated, depending on sql_mode.
mysql-test/r/ctype_utf8.result
1.73 05/09/16 10:22:57 bar@stripped +33 -0
adding test case.
mysql-test/t/ctype_utf8.test
1.69 05/09/16 10:22:52 bar@stripped +16 -0
adding test case.
sql/password.c
1.37 05/09/16 10:22:45 bar@stripped +2 -2
Changeing octet2hex from static to public.
sql/item_strfunc.cc
1.252 05/09/16 10:22:15 bar@stripped +27 -0
Result string is now checked to be well-formed.
Warning/error is generated, depending on sql_mode.
include/mysql_com.h
1.101 05/09/16 10:21:00 bar@stripped +1 -0
Bug#10504
Character set does not support traditional mode
Changeing octet2hex from static to public.
# 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: bar
# Host: bar.intranet.mysql.r18.ru
# Root: /usr/home/bar/mysql-5.0.b10504
--- 1.100/include/mysql_com.h 2005-07-05 21:46:01 +05:00
+++ 1.101/include/mysql_com.h 2005-09-16 10:21:00 +05:00
@@ -409,6 +409,7 @@
const unsigned char *hash_stage2);
void get_salt_from_password(unsigned char *res, const char *password);
void make_password_from_salt(char *to, const unsigned char *hash_stage2);
+void octet2hex(char *to, const unsigned char *str, unsigned int len);
/* end of password.c */
--- 1.251/sql/item_strfunc.cc 2005-09-01 03:24:03 +05:00
+++ 1.252/sql/item_strfunc.cc 2005-09-16 10:22:15 +05:00
@@ -1980,6 +1980,33 @@
}
str->set_charset(collation.collation);
str->realloc(str->length()); // Add end 0 (for Purify)
+
+ /* Check whether we got a well-formed string */
+ CHARSET_INFO *cs= collation.collation;
+ int well_formed_error;
+ uint wlen= cs->cset->well_formed_len(cs,
+ str->ptr(), str->ptr() + str->length(),
+ str->length(), &well_formed_error);
+ if (wlen < str->length())
+ {
+ THD *thd= current_thd;
+ char hexbuf[7];
+ enum MYSQL_ERROR::enum_warning_level level;
+ uint diff= str->length() - wlen;
+ set_if_smaller(diff, 3);
+ octet2hex(hexbuf, (const uchar*) str->ptr() + wlen, diff);
+ if (thd->variables.sql_mode &
+ (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES))
+ {
+ level= MYSQL_ERROR::WARN_LEVEL_ERROR;
+ null_value= 1;
+ str= 0;
+ }
+ else
+ level= MYSQL_ERROR::WARN_LEVEL_WARN;
+ push_warning_printf(thd, level, ER_INVALID_CHARACTER_STRING,
+ ER(ER_INVALID_CHARACTER_STRING), cs->csname, hexbuf);
+ }
return str;
}
--- 1.36/sql/password.c 2005-06-13 15:41:07 +05:00
+++ 1.37/sql/password.c 2005-09-16 10:22:45 +05:00
@@ -318,8 +318,8 @@
str, len IN the beginning and the length of the input string
*/
-static void
-octet2hex(char *to, const uint8 *str, uint len)
+void
+octet2hex(char *to, const unsigned char *str, uint len)
{
const uint8 *str_end= str + len;
for (; str != str_end; ++str)
--- 1.72/mysql-test/r/ctype_utf8.result 2005-09-12 14:09:29 +05:00
+++ 1.73/mysql-test/r/ctype_utf8.result 2005-09-16 10:22:57 +05:00
@@ -1028,6 +1028,39 @@
yyy
DROP TABLE t1;
set names utf8;
+select hex(char(1));
+hex(char(1))
+01
+select char(0xd1,0x8f);
+char(0xd1,0x8f)
+я
+select char(0xff,0x8f);
+char(0xff,0x8f)
+ÿ
+Warnings:
+Warning 1300 Invalid utf8 character string: 'FF8F'
+set sql_mode=traditional;
+select char(0xff,0x8f);
+char(0xff,0x8f)
+NULL
+Warnings:
+Error 1300 Invalid utf8 character string: 'FF8F'
+select char(195);
+char(195)
+NULL
+Warnings:
+Error 1300 Invalid utf8 character string: 'C3'
+select char(196);
+char(196)
+NULL
+Warnings:
+Error 1300 Invalid utf8 character string: 'C4'
+select char(2557);
+char(2557)
+NULL
+Warnings:
+Error 1300 Invalid utf8 character string: 'FD'
+set names utf8;
create table t1 (a char(1)) default character set utf8;
create table t2 (a char(1)) default character set utf8;
insert into t1 values('a'),('a'),(0xE38182),(0xE38182);
--- 1.68/mysql-test/t/ctype_utf8.test 2005-09-12 14:09:29 +05:00
+++ 1.69/mysql-test/t/ctype_utf8.test 2005-09-16 10:22:52 +05:00
@@ -865,6 +865,22 @@
DROP TABLE t1;
#
+# Bugs#10504: Character set does not support traditional mode
+#
+set names utf8;
+# correct value
+select hex(char(1));
+select char(0xd1,0x8f);
+# incorrect value: return with warning
+select char(0xff,0x8f);
+# incorrect value in strict mode: return NULL with "Error" level warning
+set sql_mode=traditional;
+select char(0xff,0x8f);
+select char(195);
+select char(196);
+select char(2557);
+
+#
# Bug#12891: UNION doesn't return DISTINCT result for multi-byte characters
#
set names utf8;
| Thread |
|---|
| • bk commit into 5.0 tree (bar:1.1960) BUG#10504 | bar | 16 Sep |