MySQL 8.3.0
Source Code Documentation
parse_tree_helpers.cc File Reference
#include "sql/parse_tree_helpers.h"
#include <assert.h>
#include <cstddef>
#include <initializer_list>
#include <utility>
#include <vector>
#include "lex_string.h"
#include "m_string.h"
#include "my_alloc.h"
#include "my_inttypes.h"
#include "my_sqlcommand.h"
#include "my_sys.h"
#include "mysql/mysql_lex_string.h"
#include "mysql/strings/m_ctype.h"
#include "mysql_com.h"
#include "mysqld_error.h"
#include "sql/current_thd.h"
#include "sql/dd/info_schema/show.h"
#include "sql/derror.h"
#include "sql/handler.h"
#include "sql/mem_root_array.h"
#include "sql/parse_location.h"
#include "sql/parse_tree_column_attrs.h"
#include "sql/parse_tree_nodes.h"
#include "sql/parser_yystype.h"
#include "sql/resourcegroups/platform/thread_attrs_api.h"
#include "sql/resourcegroups/resource_group_mgr.h"
#include "sql/sp_head.h"
#include "sql/sp_instr.h"
#include "sql/sp_pcontext.h"
#include "sql/sql_alter.h"
#include "sql/sql_class.h"
#include "sql/sql_error.h"
#include "sql/sql_lex.h"
#include "sql/sql_plugin_ref.h"
#include "sql/trigger_def.h"
#include "sql_string.h"
#include "strmake.h"

Functions

Item_splocalcreate_item_for_sp_var (THD *thd, LEX_CSTRING name, sp_variable *spv, const char *query_start_ptr, const char *start, const char *end)
 Create an object to represent a SP variable in the Item-hierarchy. More...
 
LEX_CSTRING make_string (THD *thd, const char *start_ptr, const char *end_ptr)
 Make a new string allocated on THD's mem-root. More...
 
void sp_create_assignment_lex (THD *thd, const char *option_ptr)
 
bool sp_create_assignment_instr (THD *thd, const char *expr_end_ptr)
 Create a SP instruction for a SET assignment. More...
 
bool resolve_engine (THD *thd, const LEX_CSTRING &name, bool is_temp_table, bool strict, handlerton **ret)
 Resolve engine by its name. More...
 
bool apply_privileges (THD *thd, const Mem_root_array< class PT_role_or_privilege * > &privs)
 This helper function is responsible for aggregating grants from parser tokens to containers and masks which can be used during semantic analysis. More...
 
bool validate_vcpu_range (const resourcegroups::Range &range)
 
bool validate_resource_group_priority (THD *thd, int *priority, const LEX_CSTRING &name, const resourcegroups::Type &type)
 
bool check_resource_group_support ()
 
bool check_resource_group_name_len (const LEX_CSTRING &name, Sql_condition::enum_severity_level severity)
 
void move_cf_appliers (Parse_context *tddlpc, Column_parse_context *cpc)
 

Function Documentation

◆ apply_privileges()

bool apply_privileges ( THD thd,
const Mem_root_array< class PT_role_or_privilege * > &  privs 
)

This helper function is responsible for aggregating grants from parser tokens to containers and masks which can be used during semantic analysis.

Parameters
thdThe thread handler
privsA list of parser tokens representing roles or privileges.
Returns
Error state
Return values
trueAn error occurred
falseSuccess

◆ check_resource_group_name_len()

bool check_resource_group_name_len ( const LEX_CSTRING name,
Sql_condition::enum_severity_level  severity 
)

◆ check_resource_group_support()

bool check_resource_group_support ( )

◆ create_item_for_sp_var()

Item_splocal * create_item_for_sp_var ( THD thd,
LEX_CSTRING  name,
sp_variable spv,
const char *  query_start_ptr,
const char *  start,
const char *  end 
)

Create an object to represent a SP variable in the Item-hierarchy.

Parameters
thdThe current thread.
nameThe SP variable name.
spvThe SP variable (optional).
query_start_ptrStart of the SQL-statement query string (optional).
startStart position of the SP variable name in the query.
endEnd position of the SP variable name in the query.
Remarks
If spv is not specified, the name is used to search for the variable in the parse-time context. If the variable does not exist, a error is set and NULL is returned to the caller.
Returns
An Item_splocal object representing the SP variable, or NULL on error.

◆ make_string()

LEX_CSTRING make_string ( THD thd,
const char *  start_ptr,
const char *  end_ptr 
)

Make a new string allocated on THD's mem-root.

Parameters
thdthread handler.
start_ptrstart of the new string.
end_ptrend of the new string.
Returns
LEX_CSTRING object, containing a pointer to a newly constructed/allocated string, and its length. The pointer is NULL in case of out-of-memory error.

◆ move_cf_appliers()

void move_cf_appliers ( Parse_context tddlpc,
Column_parse_context cpc 
)

◆ resolve_engine()

bool resolve_engine ( THD thd,
const LEX_CSTRING name,
bool  is_temp_table,
bool  strict,
handlerton **  ret 
)

Resolve engine by its name.

Parameters
thdThread handler.
nameEngine's name.
is_temp_tableTrue if temporary table.
strictForce error if engine is unknown(*).
[out]retEngine object or NULL(**).
Returns
true if error is reported(**), otherwise false.
Note
*) NO_ENGINE_SUBSTITUTION sql_mode overrides the strict parameter.
**) If strict if false and engine is unknown, the function outputs a warning, sets ret to NULL and returns false (success).

◆ sp_create_assignment_instr()

bool sp_create_assignment_instr ( THD thd,
const char *  expr_end_ptr 
)

Create a SP instruction for a SET assignment.

See also
sp_create_assignment_lex
Parameters
thdThread context
expr_end_ptrOption-value-expression end pointer
Returns
false if success, true otherwise.

◆ sp_create_assignment_lex()

void sp_create_assignment_lex ( THD thd,
const char *  option_ptr 
)

◆ validate_resource_group_priority()

bool validate_resource_group_priority ( THD thd,
int *  priority,
const LEX_CSTRING name,
const resourcegroups::Type type 
)

◆ validate_vcpu_range()

bool validate_vcpu_range ( const resourcegroups::Range range)