Description:
This is an internal refactoring.
Problem: The header files sql_lex.h is not self-sufficient and requires sql_class.h to be included before it, always. Meanwhile, sql_class.h is including sql_lex.h in the middle of the file. The reason is a design flaw: sql_class.h is defining enums that are needed by the parser and InnoDB. These enums are
- enum Key::Keytype
- enum enum_ha_read_modes
- enum enum_filetype
- enum Foreign_key::fk_match_opt
- enum Foreign_key::fk_option
How to repeat:
Try to do #include "sql_lex.h"
Suggested fix:
The fix is to move the enums to sql_class.h and make the include dependency one-way: sql_class.h depends on sql_lex.h. This is consistent with the overall architecture of the server: the parser and storage engines are separate from the optimizer and should not need to know about it. But the optimizer needs to know about the structures that the parser produces.
The enums that are class members are moved out of their classes. This makes sense as they are used in both the parser and storage engines, neither of which need - or should - know about the structures that contain them.