The code in sql_show.cc displaying INFORMATION_SCHEMA.COLUMNS.CHARACTER_OCTET_LENGTH and INFORMATION_SCHEMA.COLUMNS.CHARACTER_MAXIMUM_LENGTH:
- tests field->type() and field->real_type() for various hard-coded constant MYSQL_TYPE_XXX
- uses max_display_length() with special tricks for the BLOB data types, e.g.:
where the test for UINT_MAX32 is a workaround to address a special behavior of Field_blob::max_display_length() for LONGBLOB.
- Uses has_charset() to detect data types which need NULL to be displayed in the mentioned I_S columns.
This is non friendly to pluggable data types.
Also, this makes it hard to fix bugs in max_display_length().
Under terms of this task we'll move the code in sql_show.cc into a new virtual method in Field:
where Information_schema_character_attributes is a new class with approximately this structure: