MySQL  8.0.27
Source Code Documentation
sql_lex.h File Reference
#include <string.h>
#include <sys/types.h>
#include <algorithm>
#include <cstring>
#include <functional>
#include <map>
#include <memory>
#include <new>
#include <string>
#include <utility>
#include "lex_string.h"
#include "m_ctype.h"
#include "m_string.h"
#include "map_helpers.h"
#include "mem_root_deque.h"
#include "memory_debugging.h"
#include "my_alloc.h"
#include "my_base.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_sqlcommand.h"
#include "my_sys.h"
#include "my_table_map.h"
#include "my_thread_local.h"
#include "mysql/components/services/bits/psi_bits.h"
#include "mysql/service_mysql_alloc.h"
#include "mysql_com.h"
#include "mysqld_error.h"
#include "prealloced_array.h"
#include "sql/composite_iterators.h"
#include "sql/dd/info_schema/table_stats.h"
#include "sql/dd/info_schema/tablespace_stats.h"
#include "sql/enum_query_type.h"
#include "sql/handler.h"
#include "sql/item.h"
#include "sql/item_subselect.h"
#include "sql/join_optimizer/materialize_path_parameters.h"
#include "sql/key_spec.h"
#include "sql/mdl.h"
#include "sql/mem_root_array.h"
#include "sql/parse_tree_node_base.h"
#include "sql/parser_yystype.h"
#include "sql/query_options.h"
#include "sql/row_iterator.h"
#include "sql/set_var.h"
#include "sql/sql_array.h"
#include "sql/sql_connect.h"
#include "sql/sql_const.h"
#include "sql/sql_data_change.h"
#include "sql/sql_error.h"
#include "sql/sql_list.h"
#include "sql/sql_plugin_ref.h"
#include "sql/sql_servers.h"
#include "sql/sql_udf.h"
#include "sql/table.h"
#include "sql/thr_malloc.h"
#include "sql/trigger_def.h"
#include "sql/visible_fields.h"
#include "sql_chars.h"
#include "sql_string.h"
#include "thr_lock.h"
#include "violite.h"

Go to the source code of this file.

Classes

class  Table_ident
 
struct  LEX_MASTER_INFO
 Structure to hold parameters for CHANGE MASTER, START SLAVE, and STOP SLAVE. More...
 
struct  LEX_RESET_SLAVE
 
class  Index_hint
 
class  Query_expression
 This class represents a query expression (one query block or several query blocks combined with UNION). More...
 
class  Query_block
 This class represents a query block, aka a query specification, which is a query consisting of a SELECT keyword, followed by a table list, optionally followed by a WHERE clause, a GROUP BY, etc. More...
 
class  Condition_context
 Utility RAII class to save/modify/restore the condition_context information of a query block. More...
 
class  Secondary_engine_execution_context
 Base class for secondary engine execution context objects. More...
 
struct  struct_slave_connection
 
struct  st_sp_chistics
 
struct  st_trg_chistics
 
class  Query_tables_list
 
struct  st_parsing_options
 
class  Lex_input_stream
 This class represents the character input stream consumed during lexical analysis. More...
 
class  LEX_COLUMN
 
class  LEX_GRANT_AS
 
struct  LEX
 The LEX object currently serves three different purposes: More...
 
class  Prepare_error_tracker
 RAII class to ease the call of LEX::mark_broken() if error. More...
 
class  Yacc_state
 The internal state of the syntax parser. More...
 
struct  Parser_input
 Input parameters to the parser. More...
 
class  Parser_state
 Internal state of the parser. More...
 
class  Partition_expr_parser_state
 Parser state for partition expression parser (.frm/DD stuff) More...
 
class  Gcol_expr_parser_state
 Parser state for generated column expression parser (.frm/DD stuff) More...
 
class  Expression_parser_state
 Parser state for single expression parser (.frm/DD stuff) More...
 
class  Common_table_expr_parser_state
 Parser state for CTE subquery parser. More...
 
class  Derived_expr_parser_state
 Parser state for Derived table select expressions. More...
 
struct  st_lex_local
 

Macros

#define TYPE_ENUM_FUNCTION   1
 
#define TYPE_ENUM_PROCEDURE   2
 
#define TYPE_ENUM_TRIGGER   3
 
#define TYPE_ENUM_PROXY   4
 
#define TL_OPTION_UPDATING   0x01
 
#define TL_OPTION_IGNORE_LEAVES   0x02
 
#define TL_OPTION_ALIAS   0x04
 
#define INDEX_HINT_MASK_JOIN   (1)
 
#define INDEX_HINT_MASK_GROUP   (1 << 1)
 
#define INDEX_HINT_MASK_ORDER   (1 << 2)
 
#define INDEX_HINT_MASK_ALL    (INDEX_HINT_MASK_JOIN | INDEX_HINT_MASK_GROUP | INDEX_HINT_MASK_ORDER)
 
#define BINLOG_DIRECT_ON
 
#define BINLOG_DIRECT_OFF
 
#define TRX_CACHE_EMPTY   0x33 /* unsafe when trx-cache is empty */
 
#define TRX_CACHE_NOT_EMPTY   0xCC /* unsafe when trx-cache is not empty */
 
#define IL_LT_REPEATABLE   0xAA /* unsafe when < ISO_REPEATABLE_READ */
 
#define IL_GTE_REPEATABLE   0x55 /* unsafe when >= ISO_REPEATABLE_READ */
 

Typedefs

using List_item = mem_root_deque< Item * >
 
using Group_list_ptrs = Mem_root_array< ORDER * >
 
typedef uchar index_clause_map
 
typedef Bounds_checked_array< Item * > Ref_item_array
 
typedef struct struct_slave_connection LEX_SLAVE_CONNECTION
 

Enumerations

enum  enum_keep_diagnostics {
  DA_KEEP_NOTHING = 0 , DA_KEEP_DIAGNOSTICS , DA_KEEP_COUNTS , DA_KEEP_PARSE_ERROR ,
  DA_KEEP_UNSPECIFIED
}
 
enum  enum_sp_suid_behaviour { SP_IS_DEFAULT_SUID = 0 , SP_IS_NOT_SUID , SP_IS_SUID }
 
enum  enum_sp_data_access {
  SP_DEFAULT_ACCESS = 0 , SP_CONTAINS_SQL , SP_NO_SQL , SP_READS_SQL_DATA ,
  SP_MODIFIES_SQL_DATA
}
 
enum class  enum_sp_type {
  FUNCTION = 1 , PROCEDURE , TRIGGER , EVENT ,
  INVALID_SP_TYPE
}
 enum_sp_type defines type codes of stored programs. More...
 
enum class  Acl_type { TABLE = 0 , FUNCTION = TYPE_ENUM_FUNCTION , PROCEDURE = TYPE_ENUM_PROCEDURE }
 
enum class  enum_view_create_mode { VIEW_CREATE_NEW , VIEW_ALTER , VIEW_CREATE_OR_REPLACE }
 
enum class  enum_alter_user_attribute { ALTER_USER_COMMENT_NOT_USED , ALTER_USER_COMMENT , ALTER_USER_ATTRIBUTE }
 
enum  sub_select_type {
  UNSPECIFIED_TYPE , UNION_TYPE , INTERSECT_TYPE , EXCEPT_TYPE ,
  GLOBAL_OPTIONS_TYPE , DERIVED_TABLE_TYPE , OLAP_TYPE
}
 
enum class  enum_explain_type {
  EXPLAIN_NONE = 0 , EXPLAIN_PRIMARY , EXPLAIN_SIMPLE , EXPLAIN_DERIVED ,
  EXPLAIN_SUBQUERY , EXPLAIN_UNION , EXPLAIN_UNION_RESULT , EXPLAIN_MATERIALIZED ,
  EXPLAIN_total
}
 Query_block type enum. More...
 
enum  enum_comment_state { NO_COMMENT , PRESERVE_COMMENT , DISCARD_COMMENT }
 The state of the lexical parser, when parsing comments. More...
 

Functions

void binlog_unsafe_map_init ()
 
enum_sp_type to_sp_type (longlong val)
 
longlong to_longlong (enum_sp_type val)
 
uint to_uint (enum_sp_type val)
 
bool walk_join_list (mem_root_deque< TABLE_LIST * > &list, std::function< bool(TABLE_LIST *)> action)
 
bool lex_init (void)
 
void lex_free (void)
 
bool lex_start (THD *thd)
 Call lex_start() before every query that is to be prepared and executed. More...
 
void lex_end (LEX *lex)
 Call this function after preparation and execution of a query. More...
 
int MYSQLlex (union YYSTYPE *, struct YYLTYPE *, class THD *)
 yylex() function implementation for the main parser More...
 
void trim_whitespace (const CHARSET_INFO *cs, LEX_STRING *str)
 
bool is_lex_native_function (const LEX_STRING *name)
 Check if name is a sql function. More...
 
bool is_keyword (const char *name, size_t len)
 
bool db_is_default_db (const char *db, size_t db_len, const THD *thd)
 
bool check_select_for_locking_clause (THD *)
 
void print_derived_column_names (const THD *thd, String *str, const Create_col_name_list *column_names)
 Prints into 'str' a comma-separated list of column names, enclosed in parenthesis. More...
 
bool is_invalid_string (const LEX_CSTRING &string_val, const CHARSET_INFO *charset_info)
 (End of group GROUP_PARSER) More...
 
void assert_consistent_hidden_flags (const mem_root_deque< Item * > &fields[[maybe_unused]], Item *item[[maybe_unused]], bool hidden[[maybe_unused]])
 In debug mode, verify that we're not adding an item twice to the fields list with inconsistent hidden flags. More...
 
bool walk_item (Item *item, Select_lex_visitor *visitor)
 
bool accept_for_order (SQL_I_List< ORDER > orders, Select_lex_visitor *visitor)
 
bool accept_table (TABLE_LIST *t, Select_lex_visitor *visitor)
 
bool accept_for_join (mem_root_deque< TABLE_LIST * > *tables, Select_lex_visitor *visitor)
 
TABLE_LISTnest_join (THD *thd, Query_block *select, TABLE_LIST *embedding, mem_root_deque< TABLE_LIST * > *jlist, size_t table_cnt, const char *legend)
 Plumbing for nest_last_join, q.v. More...
 

Variables

const size_t INITIAL_LEX_PLUGIN_LIST_SIZE = 16
 
uint binlog_unsafe_map [256]
 
const LEX_CSTRING sp_data_access_name []
 
const char * index_hint_type_name []
 
const LEX_STRING null_lex_str
 LEX_STRING constant for null-string to be used in parser and other places. More...
 
sys_vartrg_new_row_fake_var
 

Macro Definition Documentation

◆ BINLOG_DIRECT_OFF

#define BINLOG_DIRECT_OFF
Value:
0xF /* unsafe when \
--binlog-direct-non-trans-updates \
is OFF */

◆ BINLOG_DIRECT_ON

#define BINLOG_DIRECT_ON
Value:
0xF0 /* unsafe when \
--binlog-direct-non-trans-updates \
is ON */

◆ IL_GTE_REPEATABLE

#define IL_GTE_REPEATABLE   0x55 /* unsafe when >= ISO_REPEATABLE_READ */

◆ IL_LT_REPEATABLE

#define IL_LT_REPEATABLE   0xAA /* unsafe when < ISO_REPEATABLE_READ */

◆ TRX_CACHE_EMPTY

#define TRX_CACHE_EMPTY   0x33 /* unsafe when trx-cache is empty */

◆ TRX_CACHE_NOT_EMPTY

#define TRX_CACHE_NOT_EMPTY   0xCC /* unsafe when trx-cache is not empty */

Function Documentation

◆ accept_for_join()

bool accept_for_join ( mem_root_deque< TABLE_LIST * > *  tables,
Select_lex_visitor visitor 
)

◆ accept_for_order()

bool accept_for_order ( SQL_I_List< ORDER orders,
Select_lex_visitor visitor 
)

◆ accept_table()

bool accept_table ( TABLE_LIST t,
Select_lex_visitor visitor 
)

◆ assert_consistent_hidden_flags()

void assert_consistent_hidden_flags ( const mem_root_deque< Item * > &fields]  [[maybe_unused],
Item *item]  [[maybe_unused],
bool hidden]  [[maybe_unused] 
)
inline

In debug mode, verify that we're not adding an item twice to the fields list with inconsistent hidden flags.

Must be called before adding the item to fields.

◆ is_invalid_string()

bool is_invalid_string ( const LEX_CSTRING string_val,
const CHARSET_INFO charset_info 
)
inline

(End of group GROUP_PARSER)

Check if the given string is invalid using the system charset.

Parameters
string_valReference to the string.
charset_infoPointer to charset info.
Returns
true if the string has an invalid encoding using the system charset else false.

◆ walk_item()

bool walk_item ( Item item,
Select_lex_visitor visitor 
)