2
Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License as
6
published by the Free Software Foundation; version 2 of the
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22
#ifndef _NETWORK_MYSQLD_BINLOG_H_
23
#define _NETWORK_MYSQLD_BINLOG_H_
25
#include "network-mysqld-proto.h"
28
* stolen from sql/log_event.h
32
#define ST_SERVER_VER_LEN 50
37
Every time you update this enum (when you add a type), you have to
38
fix Format_description_log_event::Format_description_log_event().
49
APPEND_BLOCK_EVENT= 9,
51
DELETE_FILE_EVENT= 11,
53
NEW_LOAD_EVENT is like LOAD_EVENT except that it has a longer
54
sql_ex, allowing multibyte TERMINATED BY etc; both types share the
55
same class (Load_log_event)
60
FORMAT_DESCRIPTION_EVENT= 15,
62
BEGIN_LOAD_QUERY_EVENT= 17,
63
EXECUTE_LOAD_QUERY_EVENT= 18,
67
These event numbers were used for 5.1.0 to 5.1.15 and are
70
PRE_GA_WRITE_ROWS_EVENT = 20,
71
PRE_GA_UPDATE_ROWS_EVENT = 21,
72
PRE_GA_DELETE_ROWS_EVENT = 22,
75
These event numbers are used from 5.1.16 and forward
77
WRITE_ROWS_EVENT = 23,
78
UPDATE_ROWS_EVENT = 24,
79
DELETE_ROWS_EVENT = 25,
82
Something out of the ordinary happened on the master
88
Add new events here - right above this comment!
89
Existing events (except ENUM_END_EVENT) should never change their numbers
92
ENUM_END_EVENT /* end marker */
108
} network_mysqld_table;
110
NETWORK_API network_mysqld_table *network_mysqld_table_new();
111
NETWORK_API void network_mysqld_table_free(network_mysqld_table *tbl);
112
NETWORK_API guint64 *guint64_new(guint64 i);
117
/* we have to store some information from the format description event
121
/* ... and the table-ids */
122
GHashTable *rbr_tables; /* hashed by table-id -> network_mysqld_table */
123
} network_mysqld_binlog;
125
NETWORK_API network_mysqld_binlog *network_mysqld_binlog_new();
126
NETWORK_API void network_mysqld_binlog_free(network_mysqld_binlog *binlog);
130
enum Log_event_type event_type;
151
guint16 binlog_version;
152
gchar *master_version;
154
guint8 log_header_len;
156
gsize perm_events_len;
164
guint32 charset; /* charset of the string */
167
gchar *value; /* encoded in binary speak, depends on .type */
175
guint8 table_name_len;
181
guint64 metadata_len;
184
guint32 null_bits_len;
194
guint32 used_columns_len;
197
guint32 null_bits_len;
200
gchar *row; /* raw row-buffer in the format:
201
[null-bits] [field_0, ...]
202
[null-bits] [field_0, ...]
215
} network_mysqld_binlog_event;
217
NETWORK_API network_mysqld_binlog_event *network_mysqld_binlog_event_new(void);
218
NETWORK_API void network_mysqld_binlog_event_free(network_mysqld_binlog_event *event);
219
NETWORK_API int network_mysqld_proto_get_binlog_event_header(network_packet *packet, network_mysqld_binlog_event *event);
220
NETWORK_API int network_mysqld_proto_get_binlog_event(network_packet *packet,
221
network_mysqld_binlog *binlog,
222
network_mysqld_binlog_event *event);
223
NETWORK_API int network_mysqld_proto_get_binlog_status(network_packet *packet);
230
} network_mysqld_binlog_dump;
232
NETWORK_API network_mysqld_binlog_dump *network_mysqld_binlog_dump_new();
233
NETWORK_API void network_mysqld_binlog_dump_free(network_mysqld_binlog_dump *dump);
234
NETWORK_API int network_mysqld_proto_append_binlog_dump(GString *packet, network_mysqld_binlog_dump *dump);
237
NETWORK_API int network_mysqld_binlog_event_tablemap_get(
238
network_mysqld_binlog_event *event,
239
network_mysqld_table *tbl);