MySQL 9.1.0
Source Code Documentation
mysql::binlog::event::Intvar_event Class Reference

An Intvar_event will be created just before a Query_event, if the query uses one of the variables LAST_INSERT_ID or INSERT_ID. More...

#include <statement_events.h>

Inheritance diagram for mysql::binlog::event::Intvar_event:
[legend]

Public Types

enum  Int_event_type { INVALID_INT_EVENT , LAST_INSERT_ID_EVENT , INSERT_ID_EVENT }
 
enum  Intvar_event_offset { I_TYPE_OFFSET = 0 , I_VAL_OFFSET = 1 }
 moving from pre processor symbols from global scope in log_event.h to an enum inside the class, since these are used only by members of this class itself. More...
 
- Public Types inherited from mysql::binlog::event::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

std::string get_var_type_string () const
 This method returns the string representing the type of the variable used in the event. More...
 
 Intvar_event (const char *buf, const Format_description_event *fde)
 Constructor receives a packet from the MySQL master or the binary log and decodes it to create an Intvar_event. More...
 
 Intvar_event (uint8_t type_arg, uint64_t val_arg)
 The minimal constructor for Intvar_event it initializes the instance variables type & val and set the type_code as INTVAR_EVENT in the header object in Binary_log_event. More...
 
 ~Intvar_event () override=default
 
- Public Member Functions inherited from mysql::binlog::event::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

uint8_t type
 
uint64_t val
 

Additional Inherited Members

- Static Public Attributes inherited from mysql::binlog::event::Binary_log_event
static const int LOG_EVENT_TYPES = (ENUM_END_EVENT - 1)
 
- Protected Member Functions inherited from mysql::binlog::event::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...
 

Detailed Description

An Intvar_event will be created just before a Query_event, if the query uses one of the variables LAST_INSERT_ID or INSERT_ID.

Each Intvar_event holds the value of one of these variables.

Binary Format

The Post-Header for this event type is empty. The Body has two components:

Body for Intvar_event
Name Format

Description

type 1 byte enumeration

One byte identifying the type of variable stored. Currently, two identifiers are supported: LAST_INSERT_ID_EVENT == 1 and INSERT_ID_EVENT == 2.

val 8 byte unsigned integer

The value of the variable.

Member Enumeration Documentation

◆ Int_event_type

Enumerator
INVALID_INT_EVENT 
LAST_INSERT_ID_EVENT 
INSERT_ID_EVENT 

◆ Intvar_event_offset

moving from pre processor symbols from global scope in log_event.h to an enum inside the class, since these are used only by members of this class itself.

Enumerator
I_TYPE_OFFSET 
I_VAL_OFFSET 

Constructor & Destructor Documentation

◆ Intvar_event() [1/2]

mysql::binlog::event::Intvar_event::Intvar_event ( const char *  buf,
const Format_description_event fde 
)

Constructor receives a packet from the MySQL master or the binary log and decodes it to create an Intvar_event.

The post header for the event is empty. Buffer layout for the variable data part is as follows:

  +--------------------------------+
  | type (4 bytes) | val (8 bytes) |
  +--------------------------------+
Parameters
bufContains the serialized event.
fdeAn FDE event (see Rotate_event constructor for more info).

Written every time a statement uses an AUTO_INCREMENT column or the LAST_INSERT_ID() function; precedes other events for the statement. This is written only before a QUERY_EVENT and is not used with row-based logging. An INTVAR_EVENT is written with a "subtype" in the event data part:

INSERT_ID_EVENT indicates the value to use for an AUTO_INCREMENT column in the next statement.

LAST_INSERT_ID_EVENT indicates the value to use for the LAST_INSERT_ID() function in the next statement.

◆ Intvar_event() [2/2]

mysql::binlog::event::Intvar_event::Intvar_event ( uint8_t  type_arg,
uint64_t  val_arg 
)
inline

The minimal constructor for Intvar_event it initializes the instance variables type & val and set the type_code as INTVAR_EVENT in the header object in Binary_log_event.

◆ ~Intvar_event()

mysql::binlog::event::Intvar_event::~Intvar_event ( )
overridedefault

Member Function Documentation

◆ get_var_type_string()

std::string mysql::binlog::event::Intvar_event::get_var_type_string ( ) const
inline

This method returns the string representing the type of the variable used in the event.

Changed the definition to be similar to that previously defined in log_event.cc.

Member Data Documentation

◆ type

uint8_t mysql::binlog::event::Intvar_event::type

◆ val

uint64_t mysql::binlog::event::Intvar_event::val

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