MySQL 8.0.40
Source Code Documentation
binary_log::Execute_load_query_event Class Reference

Event responsible for LOAD DATA execution, it similar to Query_event but before executing the query it substitutes original filename in LOAD DATA query with name of temporary file. More...

#include <load_data_events.h>

Inheritance diagram for binary_log::Execute_load_query_event:
[legend]

Public Types

enum  Execute_load_query_event_offset { ELQ_FILE_ID_OFFSET = QUERY_HEADER_LEN , ELQ_FN_POS_START_OFFSET = ELQ_FILE_ID_OFFSET + 4 , ELQ_FN_POS_END_OFFSET = ELQ_FILE_ID_OFFSET + 8 , ELQ_DUP_HANDLING_OFFSET = ELQ_FILE_ID_OFFSET + 12 }
 
- Public Types inherited from binary_log::Query_event
enum  Query_event_post_header_offset {
  Q_THREAD_ID_OFFSET = 0 , Q_EXEC_TIME_OFFSET = 4 , Q_DB_LEN_OFFSET = 8 , Q_ERR_CODE_OFFSET = 9 ,
  Q_STATUS_VARS_LEN_OFFSET = 11 , Q_DATA_OFFSET = QUERY_HEADER_LEN
}
 query event post-header More...
 
enum  Query_event_status_vars {
  Q_FLAGS2_CODE = 0 , Q_SQL_MODE_CODE , Q_CATALOG_CODE , Q_AUTO_INCREMENT ,
  Q_CHARSET_CODE , Q_TIME_ZONE_CODE , Q_CATALOG_NZ_CODE , Q_LC_TIME_NAMES_CODE ,
  Q_CHARSET_DATABASE_CODE , Q_TABLE_MAP_FOR_UPDATE_CODE , Q_MASTER_DATA_WRITTEN_CODE , Q_INVOKER ,
  Q_UPDATED_DB_NAMES , Q_MICROSECONDS , Q_COMMIT_TS , Q_COMMIT_TS2 ,
  Q_EXPLICIT_DEFAULTS_FOR_TIMESTAMP , Q_DDL_LOGGED_WITH_XID , Q_DEFAULT_COLLATION_FOR_UTF8MB4 , Q_SQL_REQUIRE_PRIMARY_KEY ,
  Q_DEFAULT_TABLE_ENCRYPTION
}
 
enum  enum_ternary { TERNARY_UNSET , TERNARY_OFF , TERNARY_ON }
 
- Public Types inherited from binary_log::Binary_log_event
enum  enum_post_header_length {
  QUERY_HEADER_MINIMAL_LEN = (4 + 4 + 1 + 2) , QUERY_HEADER_LEN = (QUERY_HEADER_MINIMAL_LEN + 2) , STOP_HEADER_LEN = 0 , START_V3_HEADER_LEN = (2 + ST_SERVER_VER_LEN + 4) ,
  ROTATE_HEADER_LEN = 8 , INTVAR_HEADER_LEN = 0 , APPEND_BLOCK_HEADER_LEN = 4 , DELETE_FILE_HEADER_LEN = 4 ,
  RAND_HEADER_LEN = 0 , USER_VAR_HEADER_LEN = 0 , FORMAT_DESCRIPTION_HEADER_LEN = (START_V3_HEADER_LEN + 1 + LOG_EVENT_TYPES) , XID_HEADER_LEN = 0 ,
  BEGIN_LOAD_QUERY_HEADER_LEN = APPEND_BLOCK_HEADER_LEN , ROWS_HEADER_LEN_V1 = 8 , TABLE_MAP_HEADER_LEN = 8 , EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN = (4 + 4 + 4 + 1) ,
  EXECUTE_LOAD_QUERY_HEADER_LEN , INCIDENT_HEADER_LEN = 2 , HEARTBEAT_HEADER_LEN = 0 , IGNORABLE_HEADER_LEN = 0 ,
  ROWS_HEADER_LEN_V2 = 10 , TRANSACTION_CONTEXT_HEADER_LEN = 18 , VIEW_CHANGE_HEADER_LEN = 52 , XA_PREPARE_HEADER_LEN = 0 ,
  TRANSACTION_PAYLOAD_HEADER_LEN = 0
}
 The lengths for the fixed data part of each event. More...
 

Public Member Functions

 Execute_load_query_event (uint32_t file_id_arg, uint32_t fn_pos_start, uint32_t fn_pos_end, enum_load_dup_handling dup)
 The constructor is called by MySQL slave, while applying the events. More...
 
 Execute_load_query_event (const char *buf, const Format_description_event *fde)
 The constructor receives a buffer and instantiates a Execute_load_query_event filled in with the data from the buffer. More...
 
 ~Execute_load_query_event () override=default
 
- Public Member Functions inherited from binary_log::Query_event
 Query_event (const char *query_arg, const char *catalog_arg, const char *db_arg, uint32_t query_length, unsigned long thread_id_arg, unsigned long long sql_mode_arg, unsigned long auto_increment_increment_arg, unsigned long auto_increment_offset_arg, unsigned int number, unsigned long long table_map_for_update_arg, int errcode)
 The constructor will be used while creating a Query_event, to be written to the binary log. More...
 
 Query_event (const char *buf, const Format_description_event *fde, Log_event_type event_type)
 The constructor receives a buffer and instantiates a Query_event filled in with the data from the buffer. More...
 
 Query_event (Log_event_type type_arg=QUERY_EVENT)
 The simplest constructor that could possibly work. More...
 
 ~Query_event () override=default
 
- Public Member Functions inherited from binary_log::Binary_log_event
virtual ~Binary_log_event ()=0
 
 Binary_log_event (const Binary_log_event &)=default
 
 Binary_log_event (Binary_log_event &&)=default
 
Binary_log_eventoperator= (const Binary_log_event &)=default
 
Binary_log_eventoperator= (Binary_log_event &&)=default
 
enum Log_event_type get_event_type () const
 Helper method. More...
 
const Log_event_headerheader () const
 Return a const pointer to the header of the log event. More...
 
Log_event_headerheader ()
 Return a non-const pointer to the header of the log event. More...
 
const Log_event_footerfooter () const
 Return a const pointer to the footer of the log event. More...
 
Log_event_footerfooter ()
 Return a non-const pointer to the footer of the log event. More...
 
Event_readerreader ()
 Returns a reference to the event Event_reader object. More...
 

Public Attributes

int32_t file_id
 
uint32_t fn_pos_start
 file_id of temporary file More...
 
uint32_t fn_pos_end
 pointer to the part of the query that should be substituted More...
 
enum_load_dup_handling dup_handling
 pointer to the end of this part of query More...
 
- Public Attributes inherited from binary_log::Query_event
const char * query
 
const char * db
 
const char * catalog
 
const char * time_zone_str
 
uint32_t thread_id
 
uint32_t query_exec_time
 
size_t db_len
 
uint16_t error_code
 
uint16_t status_vars_len
 
size_t q_len
 
bool flags2_inited
 
bool sql_mode_inited
 
bool charset_inited
 
uint32_t flags2
 
uint64_t sql_mode
 
uint16_t auto_increment_increment
 
uint16_t auto_increment_offset
 
char charset [6]
 
size_t time_zone_len
 
size_t catalog_len
 
uint16_t lc_time_names_number
 
uint16_t charset_database_number
 
uint64_t table_map_for_update
 
enum binary_log::Query_event::enum_ternary explicit_defaults_ts
 
unsigned char mts_accessed_dbs
 
char mts_accessed_db_names [MAX_DBS_IN_EVENT_MTS][NAME_LEN]
 
uint64_t ddl_xid
 
uint16_t default_collation_for_utf8mb4_number
 
uint8_t sql_require_primary_key
 
uint8_t default_table_encryption
 

Additional Inherited Members

- Static Public Attributes inherited from binary_log::Binary_log_event
static const int LOG_EVENT_TYPES = (ENUM_END_EVENT - 1)
 
- Protected Member Functions inherited from binary_log::Query_event
int fill_data_buf (unsigned char *dest, unsigned long len)
 Layout for the data buffer is as follows. More...
 
- Protected Member Functions inherited from binary_log::Binary_log_event
 Binary_log_event (Log_event_type type_code)
 This constructor is used to initialize the type_code of header object m_header. More...
 
 Binary_log_event (const char **buf, const Format_description_event *fde)
 This constructor will create a new object of Log_event_header and initialize the variable m_header, which in turn will be used to initialize Log_event's member common_header. More...
 
- Protected Attributes inherited from binary_log::Query_event
const char * user
 
size_t user_len
 
const char * host
 
size_t host_len
 
unsigned long data_len
 

Detailed Description

Event responsible for LOAD DATA execution, it similar to Query_event but before executing the query it substitutes original filename in LOAD DATA query with name of temporary file.

The first 13 bytes of the Post-Header for this event are the same as for Query_event, as is the initial status variable block in the Body.

Binary Format

The additional members of the events are the following:

Body for Execute_load_query_event
Name Format

Description

file_id 4 byte unsigned integer

ID of the temporary file to load

fn_pos_start 4 byte unsigned integer The start position within the statement for filename substitution
fn_pos_end 4 byte unsigned integer

The end position within the statement for filename substitution

dup_handling enum_load_dup_handling Represents information on how to handle duplicates: LOAD_DUP_ERROR= 0, LOAD_DUP_IGNORE= 1, LOAD_DUP_REPLACE= 2

Member Enumeration Documentation

◆ Execute_load_query_event_offset

Enumerator
ELQ_FILE_ID_OFFSET 

ELQ = "Execute Load Query".

ELQ_FN_POS_START_OFFSET 
ELQ_FN_POS_END_OFFSET 
ELQ_DUP_HANDLING_OFFSET 

Constructor & Destructor Documentation

◆ Execute_load_query_event() [1/2]

binary_log::Execute_load_query_event::Execute_load_query_event ( uint32_t  file_id_arg,
uint32_t  fn_pos_start,
uint32_t  fn_pos_end,
enum_load_dup_handling  dup 
)

The constructor is called by MySQL slave, while applying the events.

◆ Execute_load_query_event() [2/2]

binary_log::Execute_load_query_event::Execute_load_query_event ( const char *  buf,
const Format_description_event fde 
)

The constructor receives a buffer and instantiates a Execute_load_query_event filled in with the data from the buffer.

The constructor used in order to decode EXECUTE_LOAD_QUERY_EVENT from a packet.

The fixed event data part buffer layout is as follows:
+---------------------------------------------------------------------+
| thread_id | query_exec_time | db_len | error_code | status_vars_len |
+---------------------------------------------------------------------+
+----------------------------------------------------+
| file_id | fn_pos_start | fn_pos_end | dup_handling |
+----------------------------------------------------+
The fixed event data part buffer layout is as follows:
+------------------------------------------------------------------+
| Zero or more status variables | db |  LOAD DATA INFILE statement |
+------------------------------------------------------------------+
Parameters
bufContains the serialized event.
fdeAn FDE event (see Rotate_event constructor for more info).

It is used on the MySQL server acting as a slave.

◆ ~Execute_load_query_event()

binary_log::Execute_load_query_event::~Execute_load_query_event ( )
overridedefault

Member Data Documentation

◆ dup_handling

enum_load_dup_handling binary_log::Execute_load_query_event::dup_handling

pointer to the end of this part of query

We have to store type of duplicate handling explicitly, because for LOAD DATA it also depends on LOCAL option. And this part of query will be rewritten during replication so this information may be lost...

◆ file_id

int32_t binary_log::Execute_load_query_event::file_id

◆ fn_pos_end

uint32_t binary_log::Execute_load_query_event::fn_pos_end

pointer to the part of the query that should be substituted

◆ fn_pos_start

uint32_t binary_log::Execute_load_query_event::fn_pos_start

file_id of temporary file


The documentation for this class was generated from the following files: