WL#7203: True bottom-up server parser: refactoring of the SET statement
Affects: Prototype Only
—
Status: Complete
This WL is intended to refactor SET statement-related parser grammar rules in a pure bottom-up style to make it (grammar) context-independent for the better maintainability and extendability at the first place. This WL uses the framework and the methodology of the refactoring from the WL#7199 "True bottom-up server parser: common framework for the refactoring". The WL depends on the similar WL#7200 for the SELECT statement since that WL covers the refactoring of "expr", "subselect" etc common rules.
No functional requirements. Non-functional requirements: * no query result changes; * minor error message output changes (more specific position in the query); * no performance degradation is expected (some additional overhead is expected due to added allocation (cheap) and processing of parse nodes, however the parser rules become simpler and should compensate for other degradation. Also we eliminate a number of _current_thd() function calls -- that seems profitable.)
See WL#7199 for common detail.
The target for this WL is the "set" grammar rule. After the refactoring the statement entry for SET clause in the grammar calls the PT_set::contextualize() function at the top level: statement: ... | set { CONTEXTUALIZE($1); } The WL introduces a number of parse tree node classes: ------ PT_set ------ This class represents top-level parse tree node for the whole SET statement. -------------------------------------------------------------------- PT_start_option_value_list_no_type, PT_start_option_value_list_type, PT_start_option_value_list_transaction, PT_option_value_no_option_type_password and PT_option_value_no_option_type_password_for -------------------------------------------------------------------- These classes represent parse tree nodes for the informative part of the SET clause. * PT_start_option_value_list_no_type and PT_start_option_value_list_type: comma-separated lists of system/user variable assignments, without or with a GLOBAL/LOCAL/SESSION option. The first node class also may hold "SET CHARSET" and "SET NAMES" charset manipulations (needs further grammar polishing). * PT_start_option_value_list_transaction: transaction control stuff; * PT_option_value_no_option_type_password and PT_option_value_no_option_type_password_for: user password management. ------------------------------------------- PT_option_value_no_option_type_internal, PT_option_value_no_option_type_user_var and PT_option_value_no_option_type_sys_var ------------------------------------------- Internal/user/system variable assignments. ------------------------------------------- PT_option_value_no_option_type_charset, PT_option_value_no_option_type_names, PT_option_value_no_option_type_names_charset ------------------------------------------- "SET CHARSET" and "SET NAMES" charset manipulations. Note: PT_option_value_no_option_type_names node always contextualizes with some syntax error (the error message text historically depends on SET NAMES expression parsing). ------------------ PT_isolation_level ------------------ A parse tree node to save transaction isolation level type (READ UNCOMMITTED, REPEATABLE etc.) -------------------------- PT_transaction_access_mode -------------------------- A parse tree node to save transaction access mode (READ ONLY/READ WRITE). ------------------------------ PT_transaction_characteristics ------------------------------ A node to link PT_isolation_level and PT_transaction_access_mode nodes together.
Copyright (c) 2000, 2024, Oracle Corporation and/or its affiliates. All rights reserved.