module MysqlBinlog

The MysqlBinlog module contains a series of classes for reading and parsing binary log events from MySQL binary logs.

Constants

COLLATION

An array of collation IDs to collation and character set name for efficient lookup by ID.

COLLATION_HASH

A hash to map MySQL collation name to ID and character set name.

This hash is produced by the following query:

SELECT concat(
  "    :",
  rpad(collation_name, 24, " "),
  " => { :id => ",
  lpad(id, 3, " "),
  ", :character_set => :",
  rpad(character_set_name, 8, " "),
  " },"
) AS ruby_code
FROM information_schema.collations
ORDER BY collation_name
EVENT_HEADER_FLAGS

Values for the flags field that may appear in binary logs. There are several other values that never appear in a file but may be used in events in memory.

Defined in sql/log_event.h line ~448

EVENT_TYPES

A lookup array to map an integer event type ID to its symbol.

EVENT_TYPES_HASH

A hash of all possible event type IDs.

Enumerated in sql/log_event.h line ~539 as Log_event_type

GENERIC_ROWS_EVENT_FLAGS

A mapping array for all values that may appear in the flags field of a write_rows_event, update_rows_event, or delete_rows_event.

Enumerated in sql/log_event.h line ~3533 within Rows_log_event

GENERIC_ROWS_EVENT_VH_FIELD_TYPES
INTVAR_EVENT_INTVAR_TYPES

A mapping array for all values that may appear in the Intvar_type field of an intvar_event.

Enumerated in sql/log_event.h line ~613 as Int_event_type

MYSQL_TYPES

All MySQL types in a simple lookup array to map an integer to its symbol.

MYSQL_TYPES_HASH

All MySQL types mapping to their integer values.

QUERY_EVENT_FLAGS2

A mapping hash for all values that may appear in the flags2 field of a query_event.

Defined in sql/log_event.h line ~521 in OPTIONS_WRITTEN_TO_BIN_LOG

Defined in sql/sql_priv.h line ~84

QUERY_EVENT_OVER_MAX_DBS_IN_EVENT_MTS
QUERY_EVENT_STATUS_TYPES

A mapping array for all values that may appear in the status field of a query_event.

Defined in sql/log_event.h line ~316

ROW_EVENT_TYPES

A list of supported row-based replication event types. Since these all have an identical structure, this list can be used by other programs to know which events can be treated as row events.

TABLE_MAP_EVENT_FLAGS

A mapping array for all values that may appear in the flags field of a table_map_event.

Enumerated in sql/log_event.h line ~3413 within Table_map_log_event

TABLE_METADATA_EVENT_COLUMN_FLAGS

A mapping hash for all values that may appear in the flags field of a column descriptor for a table_metadata_event.

Defined in include/mysql_com.h line ~92

TABLE_METADATA_EVENT_FLAGS

A mapping array for all values that may appear in the flags field of a table_metadata_event.

There are none of these at the moment.

VERSION

Public Instance Methods

hexdump(data) click to toggle source

A simple method to print a string as in hex representation per byte, with no more than 24 bytes per line, and spaces between each byte. There is probably a better way to do this, but I don't know it.

# File lib/mysql_binlog/reader/debugging_reader.rb, line 5
def hexdump(data)
  data.bytes.each_slice(24).inject("") do |string, slice|
    string << "  " + slice.map { |b| "%02x" % b }.join(" ") + "\n"
    string
  end
end