MySQL  8.0.17
Source Code Documentation
sql_lex.h File Reference
#include <string.h>
#include <sys/types.h>
#include <algorithm>
#include <map>
#include <memory>
#include <new>
#include <string>
#include <type_traits>
#include <utility>
#include "lex_string.h"
#include "m_ctype.h"
#include "m_string.h"
#include "map_helpers.h"
#include "memory_debugging.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 "my_time.h"
#include "mysql/components/services/psi_statement_bits.h"
#include "mysql/psi/psi_base.h"
#include "mysql_com.h"
#include "mysqld_error.h"
#include "prealloced_array.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/field.h"
#include "sql/handler.h"
#include "sql/item.h"
#include "sql/item_subselect.h"
#include "sql/key_spec.h"
#include "sql/lex_symbol.h"
#include "sql/lexer_yystype.h"
#include "sql/mdl.h"
#include "sql/mem_root_array.h"
#include "sql/opt_hints.h"
#include "sql/parse_tree_hints.h"
#include "sql/parse_tree_node_base.h"
#include "sql/parser_yystype.h"
#include "sql/query_options.h"
#include "sql/set_var.h"
#include "sql/sql_alter.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_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_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  SELECT_LEX_UNIT
 This class represents a query expression (one query block or several query blocks combined with UNION). More...
 
class  SELECT_LEX
 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  Disable_semijoin_flattening
 Utility RAII class to save/modify/restore the semijoin_disallowed flag. 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
 
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...
 
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   1
 
#define TL_OPTION_FORCE_INDEX   2
 
#define TL_OPTION_IGNORE_LEAVES   4
 
#define TL_OPTION_ALIAS   8
 
#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

typedef List< ItemList_item
 
typedef Mem_root_array< ORDER * > Group_list_ptrs
 
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  enum_sp_type { enum_sp_type::FUNCTION = 1, enum_sp_type::PROCEDURE, enum_sp_type::TRIGGER, enum_sp_type::EVENT }
 enum_sp_type defines type codes of stored programs. More...
 
enum  Acl_type { Acl_type::TABLE = 0, Acl_type::FUNCTION = TYPE_ENUM_FUNCTION, Acl_type::PROCEDURE = TYPE_ENUM_PROCEDURE }
 
enum  enum_view_create_mode { enum_view_create_mode::VIEW_CREATE_NEW, enum_view_create_mode::VIEW_ALTER, enum_view_create_mode::VIEW_CREATE_OR_REPLACE }
 
enum  sub_select_type {
  UNSPECIFIED_TYPE, UNION_TYPE, INTERSECT_TYPE, EXCEPT_TYPE,
  GLOBAL_OPTIONS_TYPE, DERIVED_TABLE_TYPE, OLAP_TYPE
}
 
enum  enum_explain_type {
  enum_explain_type::EXPLAIN_NONE = 0, enum_explain_type::EXPLAIN_PRIMARY, enum_explain_type::EXPLAIN_SIMPLE, enum_explain_type::EXPLAIN_DERIVED,
  enum_explain_type::EXPLAIN_SUBQUERY, enum_explain_type::EXPLAIN_UNION, enum_explain_type::EXPLAIN_UNION_RESULT, enum_explain_type::EXPLAIN_MATERIALIZED,
  enum_explain_type::EXPLAIN_total
}
 SELECT_LEX 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 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...
 
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 (List< TABLE_LIST > *tables, Select_lex_visitor *visitor)
 

Variables

const size_t INITIAL_LEX_PLUGIN_LIST_SIZE = 16
 
uint binlog_unsafe_map [256]
 
const LEX_CSTRING sp_data_access_name []
 
LEX_CSTRING EMPTY_CSTR
 
LEX_CSTRING NULL_CSTR
 
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...
 
const LEX_STRING empty_lex_str
 
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 ( List< 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 
)

◆ 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 
)