ST_FIELD_INFO is used to define INFORMATION_SCHEMA columns. A typical INFORMATION_SCHEMA table definition looks like this:
It has two problems:
- It's not friently for user plugins, which may want to create INFORMATION_SCHEMA tables with their own data types.
- When a Field is created inside Type_handler_xxx::make_schema_field(), strlen() is called for ST_FIELD_INFO::field_name, for every column, every time an INFORMATION_SCHEMA query is done. This is not performance wise.
To solve these problems let do the following:
- Add a namespace Show
- Add a helper class Show::Column
- Add a number of Show classes for various data types, with this hierarchy:
This will hide internal implementation details of ST_FIELD_INFO from the upper level code. An INFORMATION_SCHEMA table definition will look like this:
This task covers the code in /sql and /plugins.
As the next step, in separate patchs, we'll do the following:
- Fix the code in /storage to use the new classes instead of direct ST_FIELD_INFO initialization.
- In ST_FIELD_INFO, replace enum_field_types field_type to const Type_handler *handler.
- In ST_FIELD_INFO, replace const char *field_name to LEX_CSTRING field_name.
which will solve the two mentioned problems.