MySQL 8.4.2
Source Code Documentation
mysql::binlog::event::User_var_event Class Reference

Written every time a statement uses a user variable; precedes other events for the statement. More...

#include <statement_events.h>

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

Public Types

enum  { UNDEF_F , UNSIGNED_F }
 
enum  User_var_event_data {
  UV_VAL_LEN_SIZE = 4 , UV_VAL_IS_NULL = 1 , UV_VAL_TYPE_SIZE = 1 , UV_NAME_LEN_SIZE = 4 ,
  UV_CHARSET_NUMBER_SIZE = 4
}
 
using Value_type = Item_result
 
- 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

 User_var_event (const char *name_arg, unsigned int name_len_arg, char *val_arg, unsigned long val_len_arg, Value_type type_arg, unsigned int charset_number_arg, unsigned char flags_arg)
 This constructor will initialize the instance variables and the type_code, it will be used only by the server code. More...
 
 User_var_event (const char *buf, const Format_description_event *fde)
 The constructor receives a buffer and instantiates a User_var_event filled in with the data from the buffer Written every time a statement uses a user variable, precedes other events for the statement. More...
 
 ~User_var_event () override
 
- 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

const char * name
 
unsigned int name_len
 
char * val
 
uint32_t val_len
 
Value_type type
 
unsigned int charset_number
 
bool is_null
 
unsigned char flags
 

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

Written every time a statement uses a user variable; precedes other events for the statement.

Indicates the value to use for the user variable in the next statement. This is written only before a QUERY_EVENT and is not used with row-based logging

The Post-Header has following components:

Post-Header for Format_description_event
Name Format

Description

Value_type enum The user variable type.
User_var_event_data enum User_var event data
name const char pointer User variable name.
name_len unsigned int Length of the user variable name
val char pointer value of the user variable.
val_len unsigned long Length of the value of the user variable
type enum Value_type Type of the user variable
charset_number unsigned int The number of the character set for the user variable (needed for a string variable). The character set number is really a collation number that indicates a character set/collation pair.
is_null bool Non-zero if the variable value is the SQL NULL value, 0 otherwise.

Member Typedef Documentation

◆ Value_type

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
UNDEF_F 
UNSIGNED_F 

◆ User_var_event_data

Enumerator
UV_VAL_LEN_SIZE 
UV_VAL_IS_NULL 
UV_VAL_TYPE_SIZE 
UV_NAME_LEN_SIZE 
UV_CHARSET_NUMBER_SIZE 

Constructor & Destructor Documentation

◆ User_var_event() [1/2]

mysql::binlog::event::User_var_event::User_var_event ( const char *  name_arg,
unsigned int  name_len_arg,
char *  val_arg,
unsigned long  val_len_arg,
Value_type  type_arg,
unsigned int  charset_number_arg,
unsigned char  flags_arg 
)
inline

This constructor will initialize the instance variables and the type_code, it will be used only by the server code.

◆ User_var_event() [2/2]

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

The constructor receives a buffer and instantiates a User_var_event filled in with the data from the buffer Written every time a statement uses a user variable, precedes other events for the statement.

Indicates the value to use for the user variable in the next statement. This is written only before a QUERY_EVENT and is not used with row-based logging.

The buffer layout for variable data part is as follows:

+-------------------------------------------------------------------+
| name_len | name | is_null | type | charset_number | val_len | val |
+-------------------------------------------------------------------+
Parameters
bufContains the serialized event.
fdeAn FDE event (see Rotate_event constructor for more info).

We need to check if this is from an old server that did not pack information for flags. We do this by checking if there are extra bytes after the packed value. If there are we take the extra byte and it's value is assumed to contain the flags value.

Old events will not have this extra byte, thence, we keep the flags set to UNDEF_F.

◆ ~User_var_event()

mysql::binlog::event::User_var_event::~User_var_event ( )
override

Member Data Documentation

◆ charset_number

unsigned int mysql::binlog::event::User_var_event::charset_number

◆ flags

unsigned char mysql::binlog::event::User_var_event::flags

◆ is_null

bool mysql::binlog::event::User_var_event::is_null

◆ name

const char* mysql::binlog::event::User_var_event::name

◆ name_len

unsigned int mysql::binlog::event::User_var_event::name_len

◆ type

Value_type mysql::binlog::event::User_var_event::type

◆ val

char* mysql::binlog::event::User_var_event::val

◆ val_len

uint32_t mysql::binlog::event::User_var_event::val_len

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