- Binlog::QUERY_EVENT:
-
The query event is used to send text querys right the binlog.
- Post-header
4 slave_proxy_id 4 execution time 1 schema length 2 error-code if binlog-version ≥ 4: 2 status-vars length
- Payload
string[$len] status-vars string[$len] schema 1 [00] string[EOF] query
- Fields
status_vars_length (2) -- number of bytes in the following sequence of
status-vars
-
status_vars (string.var_len) -- [len=$status_vars_length] a sequence of status key-value pairs. The key is 1-byte, while its value is dependent on the key.
Hex
Flag
Value Length
0x00
4
0x01
8
0x02
1 + n + 1
0x03
2 + 2
0x04
2 + 2 + 2
0x05
1 + n
0x06
1 + n
0x07
2
0x08
2
0x09
8
0x0a
4
0x0b
1 + n + 1 + n
0x0c
1 + n*nul-term-string
0x0d
3
The value of the different status vars are:
- Q_FLAGS2_CODE
-
Bitmask of flags that are usually set with
SET
:SQL_AUTO_IS_NULL
FOREIGN_KEY_CHECKS
UNIQUE_CHECKS
AUTOCOMMIT
Hex
Flag
0x00004000
OPTION_AUTO_IS_NULL
0x00080000
OPTION_NOT_AUTOCOMMIT
0x04000000
OPTION_NO_FOREIGN_KEY_CHECKS
0x08000000
OPTION_RELAXED_UNIQUE_CHECKS
- Q_SQL_MODE_CODE
-
Bitmask of flags that are usually set with
SET sql_mode
:Hex
Flag
0x00000001
MODE_REAL_AS_FLOAT
0x00000002
MODE_PIPES_AS_CONCAT
0x00000004
MODE_ANSI_QUOTES
0x00000008
MODE_IGNORE_SPACE
0x00000010
MODE_NOT_USED
0x00000020
MODE_ONLY_FULL_GROUP_BY
0x00000040
MODE_NO_UNSIGNED_SUBTRACTION
0x00000080
MODE_NO_DIR_IN_CREATE
0x00000100
MODE_POSTGRESQL
0x00000200
MODE_ORACLE
0x00000400
MODE_MSSQL
0x00000800
MODE_DB2
0x00001000
MODE_MAXDB
0x00002000
MODE_NO_KEY_OPTIONS
0x00004000
MODE_NO_TABLE_OPTIONS
0x00008000
MODE_NO_FIELD_OPTIONS
0x00010000
MODE_MYSQL323
0x00020000
MODE_MYSQL40
0x00040000
MODE_ANSI
0x00080000
MODE_NO_AUTO_VALUE_ON_ZERO
0x00100000
MODE_NO_BACKSLASH_ESCAPES
0x00200000
MODE_STRICT_TRANS_TABLES
0x00400000
MODE_STRICT_ALL_TABLES
0x00800000
MODE_NO_ZERO_IN_DATE
0x01000000
MODE_NO_ZERO_DATE
0x02000000
MODE_INVALID_DATES
0x04000000
MODE_ERROR_FOR_DIVISION_BY_ZERO
0x08000000
MODE_TRADITIONAL
0x10000000
MODE_NO_AUTO_CREATE_USER
0x20000000
MODE_HIGH_NOT_PRECEDENCE
0x40000000
MODE_NO_ENGINE_SUBSTITUTION
0x80000000
MODE_PAD_CHAR_TO_FULL_LENGTH
- Q_AUTO_INCREMENT
-
2-byte autoincrement-increment and 2-byte autoincrement-offset
Noteonly written if the -increment is > 1
- Q_CATALOG
-
1-byte length + <length> chars of the catalog + '0'-char
Noteonly written length > 0
- Q_CHARSET_CODE
-
2-byte character_set_client + 2-byte collation_connection + 2-byte collation_server
- Q_TIME_ZONE_CODE
-
1-byte length + <length> chars of the timezone
timezone the master is in
See MySQL Server Time Zone Support
Noteonly written length > 0
- Q_CATALOG_NZ_CODE
-
1-byte length + <length> chars of the catalog
Noteonly written length > 0
- Q_LC_TIME_NAMES_CODE
-
LC_TIME
of the server. Defines how to parse week-, month and day-names in timestamps.Noteonly written if code > 0 (aka "en_US")
- Q_CHARSET_DATABASE_CODE
characterset and collation of the schema
- Q_TABLE_MAP_FOR_UPDATE_CODE
a 64bit-field ... should only be used in Row Based Replication and multi-table updates
- Q_MASTER_DATA_WRITTEN_CODE
4-byte ...
- Q_INVOKERS
1-byte length + <length> bytes username and 1-byte length + <length> bytes hostname
- Q_UPDATED_DB_NAMES
1-byte count + <count>
\0
terminated string- Q_MICROSECONDS
3-byte microseconds
schema (string.var_len) -- [len=$schema_length] schema
query (string.EOF) -- text of the query