diff options
author | unknown <bar@mysql.com> | 2004-10-26 13:17:37 +0500 |
---|---|---|
committer | unknown <bar@mysql.com> | 2004-10-26 13:17:37 +0500 |
commit | e948154c8a7c608afbc763ba6c7a7e6c710421f3 (patch) | |
tree | c80ff9014190b9709b869a36e909ec7c598358ef /sql/strfunc.cc | |
parent | 2e7b38016c951d982261f24fc23ca542f7edb39b (diff) | |
download | mariadb-git-e948154c8a7c608afbc763ba6c7a7e6c710421f3.tar.gz |
Bug 6206: ENUMs are not case sensitive even if declared BINARY
The same problem with SET columns:
find_set() now executes find_type2() to do charset aware search,
instead of always using system_charset_info comparison.
Diffstat (limited to 'sql/strfunc.cc')
-rw-r--r-- | sql/strfunc.cc | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/sql/strfunc.cc b/sql/strfunc.cc index ea67a5a4343..b5255e9be06 100644 --- a/sql/strfunc.cc +++ b/sql/strfunc.cc @@ -39,16 +39,13 @@ static const char field_separator=','; -ulonglong find_set(TYPELIB *lib, const char *str, uint length, char **err_pos, - uint *err_len, bool *set_warning) +ulonglong find_set(TYPELIB *lib, const char *str, uint length, CHARSET_INFO *cs, + char **err_pos, uint *err_len, bool *set_warning) { - const char *end= str + length; - *err_pos= 0; // No error yet - while (end > str && my_isspace(system_charset_info, end[-1])) - end--; - - *err_len= 0; + CHARSET_INFO *strip= cs ? cs : &my_charset_latin1; + const char *end= str + strip->cset->lengthsp(strip, str, length); ulonglong found= 0; + *err_pos= 0; // No error yet if (str != end) { const char *start= str; @@ -59,7 +56,8 @@ ulonglong find_set(TYPELIB *lib, const char *str, uint length, char **err_pos, for (; pos != end && *pos != field_separator; pos++) ; var_len= (uint) (pos - start); - uint find= find_type(lib, start, var_len, 0); + uint find= cs ? find_type2(lib, start, var_len, cs) : + find_type(lib, start, var_len, (bool) 0); if (!find) { *err_pos= (char*) start; |