1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

CSC issue # 3299 fix:

ENUM and SET type didn't compute their length correctly.
That showed up for example while converting into a CHAR column.
This commit is contained in:
unknown
2004-08-13 19:06:24 +05:00
parent e2cfe7b607
commit 467f5956eb
4 changed files with 51 additions and 3 deletions

View File

@@ -4381,7 +4381,10 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
new_field->length=0;
for (const char **pos=interval->type_names; *pos ; pos++)
{
new_field->length+=(uint) strip_sp((char*) *pos)+1;
uint length= (uint) strip_sp((char*) *pos)+1;
CHARSET_INFO *cs= thd->variables.character_set_client;
length= cs->cset->numchars(cs, *pos, *pos+length);
new_field->length+= length;
}
new_field->length--;
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
@@ -4411,8 +4414,10 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
new_field->length=(uint) strip_sp((char*) interval->type_names[0]);
for (const char **pos=interval->type_names+1; *pos ; pos++)
{
uint length=(uint) strip_sp((char*) *pos);
set_if_bigger(new_field->length,length);
uint length=(uint) strip_sp((char*) *pos);
CHARSET_INFO *cs= thd->variables.character_set_client;
length= cs->cset->numchars(cs, *pos, *pos+length);
set_if_bigger(new_field->length,length);
}
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
if (default_value)