MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Table_map_log_event Class Reference

#include <log_event.h>

Inheritance diagram for Table_map_log_event:
Collaboration diagram for Table_map_log_event:

Public Types

enum  { TYPE_CODE = TABLE_MAP_EVENT }
enum  enum_error {
  ERR_OPEN_FAILURE = -1, ERR_OK = 0, ERR_TABLE_LIMIT_EXCEEDED = 1, ERR_OUT_OF_MEM = 2,
  ERR_BAD_TABLE_DEF = 3, ERR_RBR_TO_SBR = 4
}
enum  enum_flag { ENUM_FLAG_COUNT }
enum  { TM_NO_FLAGS = 0U, TM_BIT_LEN_EXACT_F = (1U << 0), TM_REFERRED_FK_DB_F = (1U << 1) }
typedef uint16 flag_set
- Public Types inherited from Log_event
enum  enum_skip_reason { EVENT_SKIP_NOT, EVENT_SKIP_IGNORE, EVENT_SKIP_COUNT }
typedef unsigned char Byte

Public Member Functions

flag_set get_flags (flag_set flag) const
const Table_idget_table_id () const
const char * get_table_name () const
const char * get_db_name () const
virtual Log_event_type get_type_code ()
virtual bool is_valid () const
virtual int get_data_size ()
- Public Member Functions inherited from Log_event
 Log_event (enum_event_cache_type cache_type_arg=EVENT_INVALID_CACHE, enum_event_logging_type logging_type_arg=EVENT_INVALID_LOGGING)
virtual void print (FILE *file, PRINT_EVENT_INFO *print_event_info)=0
void print_timestamp (IO_CACHE *file, time_t *ts)
void print_header (IO_CACHE *file, PRINT_EVENT_INFO *print_event_info, bool is_more)
void print_base64 (IO_CACHE *file, PRINT_EVENT_INFO *print_event_info, bool is_more)
bool wrapper_my_b_safe_write (IO_CACHE *file, const uchar *buf, ulong data_length)
void set_artificial_event ()
void set_relay_log_event ()
bool is_artificial_event () const
bool is_relay_log_event () const
bool is_ignorable_event () const
bool is_no_filter_event () const
bool is_using_trans_cache () const
bool is_using_stmt_cache () const
bool is_using_immediate_logging () const
 Log_event (const char *buf, const Format_description_log_event *description_event)
void register_temp_buf (char *buf)
void free_temp_buf ()
const char * get_type_str ()

Additional Inherited Members

- Static Public Member Functions inherited from Log_event
static Log_eventread_log_event (IO_CACHE *file, const Format_description_log_event *description_event, my_bool crc_check)
static void * operator new (size_t size)
static void operator delete (void *ptr, size_t)
static void * operator new (size_t, void *ptr)
static void operator delete (void *, void *)
static Log_eventread_log_event (const char *buf, uint event_len, const char **error, const Format_description_log_event *description_event, my_bool crc_check)
static const char * get_type_str (Log_event_type type)
- Public Attributes inherited from Log_event
my_off_t log_pos
char * temp_buf
struct timeval when
ulong exec_time
ulong data_written
uint32 server_id
uint32 unmasked_server_id
uint16 flags
ulong slave_exec_mode
enum_event_cache_type event_cache_type
enum_event_logging_type event_logging_type
ha_checksum crc
ulong mts_group_idx
Relay_log_infoworker
ulonglong future_event_relay_log_pos
uint8 checksum_alg
- Protected Types inherited from Log_event
enum  enum_event_cache_type {
  EVENT_INVALID_CACHE = 0, EVENT_STMT_CACHE, EVENT_TRANSACTIONAL_CACHE, EVENT_NO_CACHE,
  EVENT_CACHE_COUNT
}
enum  enum_event_logging_type { EVENT_INVALID_LOGGING = 0, EVENT_NORMAL_LOGGING, EVENT_IMMEDIATE_LOGGING, EVENT_CACHE_LOGGING_COUNT }

Detailed Description

In row-based mode, every row operation event is preceded by a Table_map_log_event which maps a table definition to a number. The table definition consists of database name, table name, and column definitions.

Binary Format

The Post-Header has the following components:

Post-Header for Table_map_log_event
Name Format

Description

table_id 6 bytes unsigned integer

The number that identifies the table.

flags 2 byte bitfield

Reserved for future use; currently always 0.

The Body has the following components:

Body for Table_map_log_event
Name Format

Description

database_name one byte string length, followed by null-terminated string

The name of the database in which the table resides. The name is represented as a one byte unsigned integer representing the number of bytes in the name, followed by length bytes containing the database name, followed by a terminating 0 byte. (Note the redundancy in the representation of the length.)

table_name one byte string length, followed by null-terminated string

The name of the table, encoded the same way as the database name above.

column_count Packed Integer

The number of columns in the table, represented as a packed variable-length integer.

column_type List of column_count 1 byte enumeration values

The type of each column in the table, listed from left to right. Each byte is mapped to a column type according to the enumeration type enum_field_types defined in mysql_com.h. The mapping of types to numbers is listed in the table below (along with description of the associated metadata field).

metadata_length Packed Integer

The length of the following metadata block

metadata list of metadata for each column

For each column from left to right, a chunk of data who's length and semantics depends on the type of the column. The length and semantics for the metadata for each column are listed in the table below.

null_bits column_count bits, rounded up to nearest byte

For each column, a bit indicating whether data in the column can be NULL or not. The number of bytes needed for this is int((column_count+7)/8). The flag for the first column from the left is in the least-significant bit of the first byte, the second is in the second least significant bit of the first byte, the ninth is in the least significant bit of the second byte, and so on.

The table below lists all column types, along with the numerical identifier for it and the size and interpretation of meta-data used to describe the type.

Table_map_log_event column types: numerical identifier and metadata
Name Identifier Size of metadata in bytes

Description of metadata

MYSQL_TYPE_DECIMAL0 0

No column metadata.

MYSQL_TYPE_TINY1 0

No column metadata.

MYSQL_TYPE_SHORT2 0

No column metadata.

MYSQL_TYPE_LONG3 0

No column metadata.

MYSQL_TYPE_FLOAT4 1 byte

1 byte unsigned integer, representing the "pack_length", which is equal to sizeof(float) on the server from which the event originates.

MYSQL_TYPE_DOUBLE5 1 byte

1 byte unsigned integer, representing the "pack_length", which is equal to sizeof(double) on the server from which the event originates.

MYSQL_TYPE_NULL6 0

No column metadata.

MYSQL_TYPE_TIMESTAMP7 0

No column metadata.

MYSQL_TYPE_LONGLONG8 0

No column metadata.

MYSQL_TYPE_INT249 0

No column metadata.

MYSQL_TYPE_DATE10 0

No column metadata.

MYSQL_TYPE_TIME11 0

No column metadata.

MYSQL_TYPE_DATETIME12 0

No column metadata.

MYSQL_TYPE_YEAR13 0

No column metadata.

MYSQL_TYPE_NEWDATE14

This enumeration value is only used internally and cannot exist in a binlog.

MYSQL_TYPE_VARCHAR15 2 bytes

2 byte unsigned integer representing the maximum length of the string.

MYSQL_TYPE_BIT16 2 bytes

A 1 byte unsigned int representing the length in bits of the bitfield (0 to 64), followed by a 1 byte unsigned int representing the number of bytes occupied by the bitfield. The number of bytes is either int((length+7)/8) or int(length/8).

MYSQL_TYPE_NEWDECIMAL246 2 bytes

A 1 byte unsigned int representing the precision, followed by a 1 byte unsigned int representing the number of decimals.

MYSQL_TYPE_ENUM247

This enumeration value is only used internally and cannot exist in a binlog.

MYSQL_TYPE_SET248

This enumeration value is only used internally and cannot exist in a binlog.

MYSQL_TYPE_TINY_BLOB249

This enumeration value is only used internally and cannot exist in a binlog.

MYSQL_TYPE_MEDIUM_BLOB250

This enumeration value is only used internally and cannot exist in a binlog.

MYSQL_TYPE_LONG_BLOB251

This enumeration value is only used internally and cannot exist in a binlog.

MYSQL_TYPE_BLOB252 1 byte

The pack length, i.e., the number of bytes needed to represent the length of the blob: 1, 2, 3, or 4.

MYSQL_TYPE_VAR_STRING253 2 bytes

This is used to store both strings and enumeration values. The first byte is a enumeration value storing the real type, which may be either MYSQL_TYPE_VAR_STRING or MYSQL_TYPE_ENUM. The second byte is a 1 byte unsigned integer representing the field size, i.e., the number of bytes needed to store the length of the string.

MYSQL_TYPE_STRING254 2 bytes

The first byte is always MYSQL_TYPE_VAR_STRING (i.e., 253). The second byte is the field size, i.e., the number of bytes in the representation of size of the string: 3 or 4.

MYSQL_TYPE_GEOMETRY255 1 byte

The pack length, i.e., the number of bytes needed to represent the length of the geometry: 1, 2, 3, or 4.

Definition at line 3791 of file log_event.h.

Member Enumeration Documentation

Enumeration of the errors that can be returned.

Enumerator:
ERR_OPEN_FAILURE 

Failure to open table

ERR_OK 

No error

ERR_TABLE_LIMIT_EXCEEDED 

No more room for tables

ERR_OUT_OF_MEM 

Out of memory

ERR_BAD_TABLE_DEF 

Table definition does not match

ERR_RBR_TO_SBR 

daisy-chanining RBR to SBR not allowed

Definition at line 3803 of file log_event.h.


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