Class to handle view Lex.
View lex for view query is used to validate the syntax, prepare content tree and for semantic validation. View lex is available at a) THD::lex while creating or altering a duality view, b) Table_ref::view_query() when a view is opened for any operation, c) While executing a Prepared Statement and Stored Program statement, view lex in not available. Hence, it should be re-prepared. This class is responsible for getting lex from the sources listed for duality view validation and content tree preparation.
LEX * jdv::View_lex_handler::get_view_lex |
( |
| ) |
|
|
inline |
While executing a prepared statement or SP instruction, the first Table_ref instance in the query_tables could be Table_ref instance of a view being created. Unlink it from the view query tables list.
Execute prepared PS and SP statement. For syntax validation of a view query, content tree preparation and sematic validations, AST of a view query is used. While executing PS and SP statement, view is opened but LEX instance for view query is not prepared. PS or SP instruction, contains resolved LEX of a statement. AST for view_query is not available. Hence, re-preparing only AST of a view query here.
At this stage, view_ref->query_tables are already open. Not opening tables for m_view_lex->query_tables here again. But, content_tree references TABLE instance of m_view_lex->query_tables. TABLE instance is referenced only to prepare content tree and validate semantics. Hence, just pointing m_view_lex->query_tables to TABLE referred in view_ref->query_tables.