correct temporal fields in max_display_length_for_field()

it's *display length* (a.k.a. field_length)
not storage length (a.k.a. pack_length)
This commit is contained in:
Sergei Golubchik 2016-02-19 14:17:35 +01:00
parent d4b1425b60
commit 4cabc608b6

View file

@ -98,20 +98,22 @@ max_display_length_for_field(enum_field_types sql_type, unsigned int metadata)
return 3;
case MYSQL_TYPE_DATE:
case MYSQL_TYPE_TIME:
return 3;
case MYSQL_TYPE_TIME:
return MIN_TIME_WIDTH;
case MYSQL_TYPE_TIME2:
return max_display_length_for_temporal2_field(MIN_TIME_WIDTH, metadata);
case MYSQL_TYPE_TIMESTAMP:
return 4;
return MAX_DATETIME_WIDTH;
case MYSQL_TYPE_TIMESTAMP2:
return max_display_length_for_temporal2_field(MAX_DATETIME_WIDTH, metadata);
case MYSQL_TYPE_DATETIME:
return 8;
return MAX_DATETIME_WIDTH;
case MYSQL_TYPE_DATETIME2:
return max_display_length_for_temporal2_field(MAX_DATETIME_WIDTH, metadata);