public class LoadLogEvent extends LogEvent
(1) USE db;
(2) LOAD DATA [CONCURRENT] [LOCAL] INFILE 'file_name'
(3) [REPLACE | IGNORE]
(4) INTO TABLE 'table_name'
(5) [FIELDS
(6) [TERMINATED BY 'field_term']
(7) [[OPTIONALLY] ENCLOSED BY 'enclosed']
(8) [ESCAPED BY 'escaped']
(9) ]
(10) [LINES
(11) [TERMINATED BY 'line_term']
(12) [LINES STARTING BY 'line_start']
(13) ]
(14) [IGNORE skip_lines LINES]
(15) (field_1, field_2, ..., field_n)
Binary Format: The Post-Header consists of the following six components.
| Name | Format | Description |
|---|---|---|
| slave_proxy_id | 4 byte unsigned integer | An integer identifying the client thread that issued the query. The id is unique per server. (Note, however, that two threads on different servers may have the same slave_proxy_id.) This is used when a client thread creates a temporary table local to the client. The slave_proxy_id is used to distinguish temporary tables that belong to different clients. |
| exec_time | 4 byte unsigned integer | The time from when the query started to when it was logged in the binlog, in seconds. |
| skip_lines | 4 byte unsigned integer | The number on line (14) above, if present, or 0 if line (14) is left out. |
| table_name_len | 1 byte unsigned integer | The length of 'table_name' on line (4) above. |
| db_len | 1 byte unsigned integer | The length of 'db' on line (1) above. |
| num_fields | 4 byte unsigned integer | The number n of fields on line (15) above. |
| Name | Format | Description |
|---|---|---|
| sql_ex | variable length | Describes the part of the query on lines (3) and (5)–(13) above.
More precisely, it stores the five strings (on lines) field_term (6),
enclosed (7), escaped (8), line_term (11), and line_start (12); as well as a
bitfield indicating the presence of the keywords REPLACE (3), IGNORE (3), and
OPTIONALLY (7). The data is stored in one of two formats, called "old" and
"new". The type field of Common-Header determines which of these two formats
is used: type LOAD_EVENT means that the old format is used, and type
NEW_LOAD_EVENT means that the new format is used. When MySQL writes a
Load_log_event, it uses the new format if at least one of the five strings is
two or more bytes long. Otherwise (i.e., if all strings are 0 or 1 bytes
long), the old format is used. The new and old format differ in the way the
five strings are stored.
|
| field_lens | num_fields 1 byte unsigned integers | An array of num_fields integers representing the length of each field in the query. (num_fields is from the Post-Header). |
| fields | num_fields null-terminated strings | An array of num_fields null-terminated strings, each representing a field in the query. (The trailing zero is redundant, since the length are stored in the num_fields array.) The total length of all strings equals to the sum of all field_lens, plus num_fields bytes for all the trailing zeros. |
| table_name | null-terminated string of length table_len+1 bytes | The 'table_name' from the query, as a null-terminated string. (The trailing zero is actually redundant since the table_len is known from Post-Header.) |
| db | null-terminated string of length db_len+1 bytes | The 'db' from the query, as a null-terminated string. (The trailing zero is actually redundant since the db_len is known from Post-Header.) |
| file_name | variable length string without trailing zero, extending to the end of the event (determined by the length field of the Common-Header) | The 'file_name' from the query. |
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
DUMPFILE_FLAG |
static int |
ENCLOSED_EMPTY |
static int |
ESCAPED_EMPTY |
static int |
FIELD_TERM_EMPTY |
static int |
IGNORE_FLAG |
static int |
L_DATA_OFFSET |
static int |
L_DB_LEN_OFFSET |
static int |
L_EXEC_TIME_OFFSET |
static int |
L_NUM_FIELDS_OFFSET |
static int |
L_SKIP_LINES_OFFSET |
static int |
L_SQL_EX_OFFSET |
static int |
L_TBL_LEN_OFFSET |
static int |
L_THREAD_ID_OFFSET |
static int |
LINE_START_EMPTY |
static int |
LINE_TERM_EMPTY |
static int |
OPT_ENCLOSED_FLAG |
static int |
REPLACE_FLAG |
ANNOTATE_ROWS_EVENT, ANONYMOUS_GTID_LOG_EVENT, APPEND_BLOCK_EVENT, BEGIN_LOAD_QUERY_EVENT, BINLOG_CHECKPOINT_EVENT, BINLOG_CHECKSUM_ALG_CRC32, BINLOG_CHECKSUM_ALG_DESC_LEN, BINLOG_CHECKSUM_ALG_ENUM_END, BINLOG_CHECKSUM_ALG_OFF, BINLOG_CHECKSUM_ALG_UNDEF, BINLOG_CHECKSUM_LEN, BINLOG_VERSION, CHECKSUM_CRC32_SIGNATURE_LEN, CREATE_FILE_EVENT, DELETE_FILE_EVENT, DELETE_ROWS_EVENT, DELETE_ROWS_EVENT_V1, ENUM_END_EVENT, EVENT_LEN_OFFSET, EVENT_TYPE_OFFSET, EXEC_LOAD_EVENT, EXECUTE_LOAD_QUERY_EVENT, EXTRA_ROW_INFO_FORMAT_OFFSET, EXTRA_ROW_INFO_HDR_BYTES, EXTRA_ROW_INFO_LEN_OFFSET, EXTRA_ROW_INFO_MAX_PAYLOAD, FLAGS_OFFSET, FORMAT_DESCRIPTION_EVENT, GTID_EVENT, GTID_LIST_EVENT, GTID_LOG_EVENT, header, HEARTBEAT_LOG_EVENT, IGNORABLE_LOG_EVENT, INCIDENT_EVENT, INTVAR_EVENT, LOAD_EVENT, LOG_EVENT_IGNORABLE_F, LOG_POS_OFFSET, logger, MARIA_EVENTS_BEGIN, MARIA_SLAVE_CAPABILITY_ANNOTATE, MARIA_SLAVE_CAPABILITY_BINLOG_CHECKPOINT, MARIA_SLAVE_CAPABILITY_GTID, MARIA_SLAVE_CAPABILITY_MINE, MARIA_SLAVE_CAPABILITY_TOLERATE_HOLES, MARIA_SLAVE_CAPABILITY_UNKNOWN, MYSQL_EVENTS_END, MYSQL_TYPE_BIT, MYSQL_TYPE_BLOB, MYSQL_TYPE_DATE, MYSQL_TYPE_DATETIME, MYSQL_TYPE_DATETIME2, MYSQL_TYPE_DECIMAL, MYSQL_TYPE_DOUBLE, MYSQL_TYPE_ENUM, MYSQL_TYPE_FLOAT, MYSQL_TYPE_GEOMETRY, MYSQL_TYPE_INT24, MYSQL_TYPE_JSON, MYSQL_TYPE_LONG, MYSQL_TYPE_LONG_BLOB, MYSQL_TYPE_LONGLONG, MYSQL_TYPE_MEDIUM_BLOB, MYSQL_TYPE_NEWDATE, MYSQL_TYPE_NEWDECIMAL, MYSQL_TYPE_NULL, MYSQL_TYPE_SET, MYSQL_TYPE_SHORT, MYSQL_TYPE_STRING, MYSQL_TYPE_TIME, MYSQL_TYPE_TIME2, MYSQL_TYPE_TIMESTAMP, MYSQL_TYPE_TIMESTAMP2, MYSQL_TYPE_TINY, MYSQL_TYPE_TINY_BLOB, MYSQL_TYPE_VAR_STRING, MYSQL_TYPE_VARCHAR, MYSQL_TYPE_YEAR, NEW_LOAD_EVENT, PRE_GA_DELETE_ROWS_EVENT, PRE_GA_UPDATE_ROWS_EVENT, PRE_GA_WRITE_ROWS_EVENT, PREVIOUS_GTIDS_LOG_EVENT, QUERY_EVENT, QUERY_HEADER_LEN, QUERY_HEADER_MINIMAL_LEN, RAND_EVENT, ROTATE_EVENT, ROWS_QUERY_LOG_EVENT, SERVER_ID_OFFSET, SERVER_VERSION, SLAVE_EVENT, START_EVENT_V3, STOP_EVENT, TABLE_MAP_EVENT, UNKNOWN_EVENT, UPDATE_ROWS_EVENT, UPDATE_ROWS_EVENT_V1, USER_VAR_EVENT, WRITE_ROWS_EVENT, WRITE_ROWS_EVENT_V1, XID_EVENT| 构造器和说明 |
|---|
LoadLogEvent(LogHeader header,
LogBuffer buffer,
FormatDescriptionLogEvent descriptionEvent) |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
copyLogEvent(LogBuffer buffer,
int bodyOffset,
FormatDescriptionLogEvent descriptionEvent) |
String |
getDb() |
int |
getEmptyFlags() |
String |
getEnclosed() |
String |
getEscaped() |
long |
getExecTime() |
String[] |
getFields() |
String |
getFieldTerm() |
String |
getFname() |
String |
getLineStart() |
String |
getLineTerm() |
int |
getOptFlags() |
int |
getSkipLines() |
String |
getTable() |
getEventLen, getHeader, getLogPos, getServerId, getTypeName, getWhenpublic static final int L_THREAD_ID_OFFSET
public static final int L_EXEC_TIME_OFFSET
public static final int L_SKIP_LINES_OFFSET
public static final int L_TBL_LEN_OFFSET
public static final int L_DB_LEN_OFFSET
public static final int L_NUM_FIELDS_OFFSET
public static final int L_SQL_EX_OFFSET
public static final int L_DATA_OFFSET
public static final int DUMPFILE_FLAG
public static final int OPT_ENCLOSED_FLAG
public static final int REPLACE_FLAG
public static final int IGNORE_FLAG
public static final int FIELD_TERM_EMPTY
public static final int ENCLOSED_EMPTY
public static final int LINE_TERM_EMPTY
public static final int LINE_START_EMPTY
public static final int ESCAPED_EMPTY
public LoadLogEvent(LogHeader header, LogBuffer buffer, FormatDescriptionLogEvent descriptionEvent)
protected final void copyLogEvent(LogBuffer buffer, int bodyOffset, FormatDescriptionLogEvent descriptionEvent)
public final String getTable()
public final String getDb()
public final String getFname()
public final int getSkipLines()
public final String[] getFields()
public final String getFieldTerm()
public final String getLineTerm()
public final String getLineStart()
public final String getEnclosed()
public final String getEscaped()
public final int getOptFlags()
public final int getEmptyFlags()
public final long getExecTime()
Copyright © 2017. All rights reserved.