32
32
#ifndef _log_event_h
33
33
#define _log_event_h
35
#if defined(USE_PRAGMA_INTERFACE) && !defined(DRIZZLE_CLIENT)
35
#if defined(USE_PRAGMA_INTERFACE)
36
36
#pragma interface /* gcc class implementation */
39
39
#include <mysys/my_bitmap.h>
40
40
#include "rpl_constants.h"
41
#ifndef DRIZZLE_CLIENT
42
41
#include "rpl_record.h"
43
42
#include "rpl_reporting.h"
45
#include "my_decimal.h"
48
44
#include <drizzled/sql_string.h> /* append_query_string() needs String declaration */
554
#ifndef DRIZZLE_CLIENT
556
551
class DRIZZLE_BIN_LOG;
560
554
class Format_description_log_event;
561
555
class Relay_log_info;
563
#ifdef DRIZZLE_CLIENT
564
enum enum_base64_output_mode {
565
BASE64_OUTPUT_NEVER= 0,
566
BASE64_OUTPUT_AUTO= 1,
567
BASE64_OUTPUT_ALWAYS= 2,
568
BASE64_OUTPUT_UNSPEC= 3,
569
/* insert new output modes here */
570
BASE64_OUTPUT_MODE_COUNT
574
A structure for mysqlbinlog to know how to print events
576
This structure is passed to the event's print() methods,
578
There are two types of settings stored here:
579
1. Last db, flags2, sql_mode etc comes from the last printed event.
580
They are stored so that only the necessary USE and SET commands
582
2. Other information on how to print the events, e.g. short_form,
583
hexdump_from. These are not dependent on the last event.
585
typedef struct st_print_event_info
588
Settings for database, sql_mode etc that comes from the last event
589
that was printed. We cache these so that we don't have to print
590
them if they are unchanged.
592
// TODO: have the last catalog here ??
593
char db[FN_REFLEN+1]; // TODO: make this a LEX_STRING when thd->db is
596
bool sql_mode_inited;
597
ulong sql_mode; /* must be same as THD.variables.sql_mode */
598
ulong auto_increment_increment, auto_increment_offset;
600
char charset[6]; // 3 variables, each of them storable in 2 bytes
601
char time_zone_str[MAX_TIME_ZONE_NAME_LENGTH];
602
uint32_t lc_time_names_number;
603
uint charset_database_number;
605
bool thread_id_printed;
607
st_print_event_info();
609
~st_print_event_info() {
610
close_cached_file(&head_cache);
611
close_cached_file(&body_cache);
613
bool init_ok() /* tells if construction was successful */
614
{ return my_b_inited(&head_cache) && my_b_inited(&body_cache); }
617
/* Settings on how to print the events */
619
enum_base64_output_mode base64_output_mode;
621
This is set whenever a Format_description_event is printed.
622
Later, when an event is printed in base64, this flag is tested: if
623
no Format_description_event has been seen, it is unsafe to print
624
the base64 event, so an error message is generated.
626
bool printed_fd_event;
627
my_off_t hexdump_from;
628
uint8_t common_header_len;
632
These two caches are used by the row-based replication events to
633
collect the header information and the main body of the events
634
making up a statement.
642
558
the struct aggregates two paramenters that identify an event
643
559
uniquely in scope of communication of a particular master and slave couple.
910
824
virtual void pack_info(Protocol *protocol);
912
#endif /* HAVE_REPLICATION */
913
826
virtual const char* get_db()
915
828
return thd ? thd->db : 0;
918
Log_event() : temp_buf(0) {}
919
/* avoid having to link mysqlbinlog against libpthread */
920
static Log_event* read_log_event(IO_CACHE* file,
921
const Format_description_log_event
923
/* print*() functions are used by mysqlbinlog */
924
virtual void print(FILE* file, PRINT_EVENT_INFO* print_event_info) = 0;
925
void print_timestamp(IO_CACHE* file, time_t *ts = 0);
926
void print_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info,
928
void print_base64(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info,
932
831
static void *operator new(size_t size)
1558
1453
uint lc_time_names_number; /* 0 means en_US */
1559
1454
uint charset_database_number;
1561
#ifndef DRIZZLE_CLIENT
1563
1457
Query_log_event(THD* thd_arg, const char* query_arg, ulong query_length,
1564
1458
bool using_trans, bool suppress_use,
1565
1459
THD::killed_state killed_err_arg= THD::KILLED_NO_VALUE);
1566
1460
const char* get_db() { return db; }
1567
#ifdef HAVE_REPLICATION
1568
1461
void pack_info(Protocol* protocol);
1569
#endif /* HAVE_REPLICATION */
1571
void print_query_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info);
1572
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
1575
1463
Query_log_event();
1576
1464
Query_log_event(const char* buf, uint event_len,
1582
1470
my_free((uchar*) data_buf, MYF(0));
1584
1472
Log_event_type get_type_code() { return QUERY_EVENT; }
1585
#ifndef DRIZZLE_CLIENT
1586
1473
bool write(IO_CACHE* file);
1587
1474
virtual bool write_post_header_for_derived(IO_CACHE* file __attribute__((unused)))
1588
1475
{ return false; }
1590
1476
bool is_valid() const { return query != 0; }
1597
1483
/* Writes derived event-specific part of post header. */
1599
1485
public: /* !!! Public in this patch to allow old usage */
1600
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
1601
1486
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
1602
1487
virtual int do_apply_event(Relay_log_info const *rli);
1603
1488
virtual int do_update_pos(Relay_log_info *rli);
1672
1554
int master_log_len;
1673
1555
uint16_t master_port;
1675
#ifndef DRIZZLE_CLIENT
1676
1557
Slave_log_event(THD* thd_arg, Relay_log_info* rli);
1677
1558
void pack_info(Protocol* protocol);
1679
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
1682
1560
Slave_log_event(const char* buf, uint event_len);
1683
1561
~Slave_log_event();
1684
1562
int get_data_size();
1685
1563
bool is_valid() const { return master_host != 0; }
1686
1564
Log_event_type get_type_code() { return SLAVE_EVENT; }
1687
#ifndef DRIZZLE_CLIENT
1688
1565
bool write(IO_CACHE* file);
1692
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
1693
1568
virtual int do_apply_event(Relay_log_info const* rli);
1697
#endif /* HAVE_REPLICATION */
1701
1573
@class Load_log_event
1954
1825
void set_fields(const char* db, List<Item> &fields_arg,
1955
1826
Name_resolution_context *context);
1956
1827
const char* get_db() { return db; }
1957
#ifdef HAVE_REPLICATION
1958
1828
void pack_info(Protocol* protocol);
1959
#endif /* HAVE_REPLICATION */
1961
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
1962
void print(FILE* file, PRINT_EVENT_INFO* print_event_info, bool commented);
1966
1831
Note that for all the events related to LOAD DATA (Load_log_event,
2058
1919
bool dont_set_created;
2060
#ifndef DRIZZLE_CLIENT
2061
1921
Start_log_event_v3();
2062
#ifdef HAVE_REPLICATION
2063
1922
void pack_info(Protocol* protocol);
2064
#endif /* HAVE_REPLICATION */
2066
Start_log_event_v3() {}
2067
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2070
1924
Start_log_event_v3(const char* buf,
2071
1925
const Format_description_log_event* description_event);
2072
1926
~Start_log_event_v3() {}
2073
1927
Log_event_type get_type_code() { return START_EVENT_V3;}
2074
#ifndef DRIZZLE_CLIENT
2075
1928
bool write(IO_CACHE* file);
2077
1929
bool is_valid() const { return 1; }
2078
1930
int get_data_size()
2210
#ifndef DRIZZLE_CLIENT
2211
2056
Intvar_log_event(THD* thd_arg,uchar type_arg, uint64_t val_arg)
2212
2057
:Log_event(thd_arg,0,0),val(val_arg),type(type_arg)
2214
#ifdef HAVE_REPLICATION
2215
2059
void pack_info(Protocol* protocol);
2216
#endif /* HAVE_REPLICATION */
2218
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2221
2061
Intvar_log_event(const char* buf,
2222
2062
const Format_description_log_event *description_event);
2224
2064
Log_event_type get_type_code() { return INTVAR_EVENT;}
2225
2065
const char* get_var_type_name();
2226
2066
int get_data_size() { return 9; /* sizeof(type) + sizeof(val) */;}
2227
#ifndef DRIZZLE_CLIENT
2228
2067
bool write(IO_CACHE* file);
2230
2068
bool is_valid() const { return 1; }
2233
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2234
2071
virtual int do_apply_event(Relay_log_info const *rli);
2235
2072
virtual int do_update_pos(Relay_log_info *rli);
2236
2073
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
2282
2118
uint64_t seed1;
2283
2119
uint64_t seed2;
2285
#ifndef DRIZZLE_CLIENT
2286
2121
Rand_log_event(THD* thd_arg, uint64_t seed1_arg, uint64_t seed2_arg)
2287
2122
:Log_event(thd_arg,0,0),seed1(seed1_arg),seed2(seed2_arg)
2289
#ifdef HAVE_REPLICATION
2290
2124
void pack_info(Protocol* protocol);
2291
#endif /* HAVE_REPLICATION */
2293
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2296
2126
Rand_log_event(const char* buf,
2297
2127
const Format_description_log_event *description_event);
2298
2128
~Rand_log_event() {}
2299
2129
Log_event_type get_type_code() { return RAND_EVENT;}
2300
2130
int get_data_size() { return 16; /* sizeof(uint64_t) * 2*/ }
2301
#ifndef DRIZZLE_CLIENT
2302
2131
bool write(IO_CACHE* file);
2304
2132
bool is_valid() const { return 1; }
2307
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2308
2135
virtual int do_apply_event(Relay_log_info const *rli);
2309
2136
virtual int do_update_pos(Relay_log_info *rli);
2310
2137
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
2320
2146
@section Xid_log_event_binary_format Binary Format
2322
#ifdef DRIZZLE_CLIENT
2323
typedef uint64_t my_xid; // this line is the same as in handler.h
2326
2148
class Xid_log_event: public Log_event
2331
#ifndef DRIZZLE_CLIENT
2332
2153
Xid_log_event(THD* thd_arg, my_xid x): Log_event(thd_arg,0,0), xid(x) {}
2333
#ifdef HAVE_REPLICATION
2334
2154
void pack_info(Protocol* protocol);
2335
#endif /* HAVE_REPLICATION */
2337
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2340
2156
Xid_log_event(const char* buf,
2341
2157
const Format_description_log_event *description_event);
2342
2158
~Xid_log_event() {}
2343
2159
Log_event_type get_type_code() { return XID_EVENT;}
2344
2160
int get_data_size() { return sizeof(xid); }
2345
#ifndef DRIZZLE_CLIENT
2346
2161
bool write(IO_CACHE* file);
2348
2162
bool is_valid() const { return 1; }
2351
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2352
2165
virtual int do_apply_event(Relay_log_info const *rli);
2353
2166
enum_skip_reason do_shall_skip(Relay_log_info *rli);
2373
2185
Item_result type;
2374
2186
uint charset_number;
2376
#ifndef DRIZZLE_CLIENT
2377
2188
User_var_log_event(THD* thd_arg __attribute__((unused)),
2378
2189
char *name_arg, uint name_len_arg,
2379
2190
char *val_arg, ulong val_len_arg, Item_result type_arg,
2382
2193
val_len(val_len_arg), type(type_arg), charset_number(charset_number_arg)
2383
2194
{ is_null= !val; }
2384
2195
void pack_info(Protocol* protocol);
2386
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2389
2197
User_var_log_event(const char* buf,
2390
2198
const Format_description_log_event *description_event);
2391
2199
~User_var_log_event() {}
2392
2200
Log_event_type get_type_code() { return USER_VAR_EVENT;}
2393
#ifndef DRIZZLE_CLIENT
2394
2201
bool write(IO_CACHE* file);
2396
2202
bool is_valid() const { return 1; }
2399
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2400
2205
virtual int do_apply_event(Relay_log_info const *rli);
2401
2206
virtual int do_update_pos(Relay_log_info *rli);
2402
2207
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
2415
2219
class Stop_log_event: public Log_event
2418
#ifndef DRIZZLE_CLIENT
2419
2222
Stop_log_event() :Log_event()
2422
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2425
2225
Stop_log_event(const char* buf,
2426
2226
const Format_description_log_event *description_event):
2507
2305
uint ident_len;
2509
#ifndef DRIZZLE_CLIENT
2510
2307
Rotate_log_event(const char* new_log_ident_arg,
2511
2308
uint ident_len_arg,
2512
2309
uint64_t pos_arg, uint flags);
2513
#ifdef HAVE_REPLICATION
2514
2310
void pack_info(Protocol* protocol);
2515
#endif /* HAVE_REPLICATION */
2517
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2520
2312
Rotate_log_event(const char* buf, uint event_len,
2521
2313
const Format_description_log_event* description_event);
2527
2319
Log_event_type get_type_code() { return ROTATE_EVENT;}
2528
2320
int get_data_size() { return ident_len + ROTATE_HEADER_LEN;}
2529
2321
bool is_valid() const { return new_log_ident != 0; }
2530
#ifndef DRIZZLE_CLIENT
2531
2322
bool write(IO_CACHE* file);
2535
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2536
2325
virtual int do_update_pos(Relay_log_info *rli);
2537
2326
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
2564
2352
bool inited_from_old;
2566
#ifndef DRIZZLE_CLIENT
2567
2354
Create_file_log_event(THD* thd, sql_exchange* ex, const char* db_arg,
2568
2355
const char* table_name_arg,
2569
2356
List<Item>& fields_arg,
2570
2357
enum enum_duplicates handle_dup, bool ignore,
2571
2358
uchar* block_arg, uint block_len_arg,
2572
2359
bool using_trans);
2573
#ifdef HAVE_REPLICATION
2574
2360
void pack_info(Protocol* protocol);
2575
#endif /* HAVE_REPLICATION */
2577
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2578
void print(FILE* file, PRINT_EVENT_INFO* print_event_info,
2582
2362
Create_file_log_event(const char* buf, uint event_len,
2583
2363
const Format_description_log_event* description_event);
2640
2416
const char* db;
2642
#ifndef DRIZZLE_CLIENT
2643
2418
Append_block_log_event(THD* thd, const char* db_arg, uchar* block_arg,
2644
2419
uint block_len_arg, bool using_trans);
2645
#ifdef HAVE_REPLICATION
2646
2420
void pack_info(Protocol* protocol);
2647
2421
virtual int get_create_or_append() const;
2648
#endif /* HAVE_REPLICATION */
2650
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2653
2423
Append_block_log_event(const char* buf, uint event_len,
2654
2424
const Format_description_log_event
2657
2427
Log_event_type get_type_code() { return APPEND_BLOCK_EVENT;}
2658
2428
int get_data_size() { return block_len + APPEND_BLOCK_HEADER_LEN ;}
2659
2429
bool is_valid() const { return block != 0; }
2660
#ifndef DRIZZLE_CLIENT
2661
2430
bool write(IO_CACHE* file);
2662
2431
const char* get_db() { return db; }
2666
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2667
2434
virtual int do_apply_event(Relay_log_info const *rli);
2682
2448
const char* db; /* see comment in Append_block_log_event */
2684
#ifndef DRIZZLE_CLIENT
2685
2450
Delete_file_log_event(THD* thd, const char* db_arg, bool using_trans);
2686
#ifdef HAVE_REPLICATION
2687
2451
void pack_info(Protocol* protocol);
2688
#endif /* HAVE_REPLICATION */
2690
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2691
void print(FILE* file, PRINT_EVENT_INFO* print_event_info,
2695
2453
Delete_file_log_event(const char* buf, uint event_len,
2696
2454
const Format_description_log_event* description_event);
2698
2456
Log_event_type get_type_code() { return DELETE_FILE_EVENT;}
2699
2457
int get_data_size() { return DELETE_FILE_HEADER_LEN ;}
2700
2458
bool is_valid() const { return file_id != 0; }
2701
#ifndef DRIZZLE_CLIENT
2702
2459
bool write(IO_CACHE* file);
2703
2460
const char* get_db() { return db; }
2707
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2708
2463
virtual int do_apply_event(Relay_log_info const *rli);
2723
2477
const char* db; /* see comment in Append_block_log_event */
2725
#ifndef DRIZZLE_CLIENT
2726
2479
Execute_load_log_event(THD* thd, const char* db_arg, bool using_trans);
2727
#ifdef HAVE_REPLICATION
2728
2480
void pack_info(Protocol* protocol);
2729
#endif /* HAVE_REPLICATION */
2731
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2734
2482
Execute_load_log_event(const char* buf, uint event_len,
2735
2483
const Format_description_log_event
2738
2486
Log_event_type get_type_code() { return EXEC_LOAD_EVENT;}
2739
2487
int get_data_size() { return EXEC_LOAD_HEADER_LEN ;}
2740
2488
bool is_valid() const { return file_id != 0; }
2741
#ifndef DRIZZLE_CLIENT
2742
2489
bool write(IO_CACHE* file);
2743
2490
const char* get_db() { return db; }
2747
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2748
2493
virtual int do_apply_event(Relay_log_info const *rli);
2762
2506
class Begin_load_query_log_event: public Append_block_log_event
2765
#ifndef DRIZZLE_CLIENT
2766
2509
Begin_load_query_log_event(THD* thd_arg, const char *db_arg,
2767
2510
uchar* block_arg, uint block_len_arg,
2768
2511
bool using_trans);
2769
#ifdef HAVE_REPLICATION
2770
2512
Begin_load_query_log_event(THD* thd);
2771
2513
int get_create_or_append() const;
2772
#endif /* HAVE_REPLICATION */
2774
2514
Begin_load_query_log_event(const char* buf, uint event_len,
2775
2515
const Format_description_log_event
2776
2516
*description_event);
2777
2517
~Begin_load_query_log_event() {}
2778
2518
Log_event_type get_type_code() { return BEGIN_LOAD_QUERY_EVENT; }
2780
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2781
2520
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
2821
2558
bool using_trans, bool suppress_use,
2822
2559
THD::killed_state
2823
2560
killed_err_arg= THD::KILLED_NO_VALUE);
2824
#ifdef HAVE_REPLICATION
2825
2561
void pack_info(Protocol* protocol);
2826
#endif /* HAVE_REPLICATION */
2828
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2829
/* Prints the query as LOAD DATA LOCAL and with rewritten filename */
2830
void print(FILE* file, PRINT_EVENT_INFO* print_event_info,
2831
const char *local_fname);
2833
2562
Execute_load_query_log_event(const char* buf, uint event_len,
2834
2563
const Format_description_log_event
2835
2564
*description_event);
2839
2568
bool is_valid() const { return Query_log_event::is_valid() && file_id != 0; }
2841
2570
ulong get_post_header_size_for_derived();
2842
#ifndef DRIZZLE_CLIENT
2843
2571
bool write_post_header_for_derived(IO_CACHE* file);
2847
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2848
2574
virtual int do_apply_event(Relay_log_info const *rli);
2853
#ifdef DRIZZLE_CLIENT
2855
@class Unknown_log_event
2857
@section Unknown_log_event_binary_format Binary Format
2859
class Unknown_log_event: public Log_event
2863
Even if this is an unknown event, we still pass description_event to
2864
Log_event's ctor, this way we can extract maximum information from the
2865
event's header (the unique ID for example).
2867
Unknown_log_event(const char* buf,
2868
const Format_description_log_event *description_event):
2869
Log_event(buf, description_event)
2871
~Unknown_log_event() {}
2872
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2873
Log_event_type get_type_code() { return UNKNOWN_EVENT;}
2874
bool is_valid() const { return 1; }
2877
2578
char *str_to_hex(char *to, const char *from, uint len);
3167
2868
void clear_flags(flag_set flag) { m_flags &= ~flag; }
3168
2869
flag_set get_flags(flag_set flag) const { return m_flags & flag; }
3170
#ifndef DRIZZLE_CLIENT
3171
2871
Table_map_log_event(THD *thd, Table *tbl, ulong tid,
3172
2872
bool is_transactional, uint16_t flags);
3174
#ifdef HAVE_REPLICATION
3175
2873
Table_map_log_event(const char *buf, uint event_len,
3176
2874
const Format_description_log_event *description_event);
3179
2876
~Table_map_log_event();
3182
2879
virtual bool is_valid() const { return m_memory != NULL; /* we check malloc */ }
3184
2881
virtual int get_data_size() { return m_data_size; }
3185
#ifndef DRIZZLE_CLIENT
3186
2882
virtual int save_field_metadata();
3187
2883
virtual bool write_data_header(IO_CACHE *file);
3188
2884
virtual bool write_data_body(IO_CACHE *file);
3189
2885
virtual const char *get_db() { return m_dbnam; }
3192
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3193
2886
virtual void pack_info(Protocol *protocol);
3196
#ifdef DRIZZLE_CLIENT
3197
virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
3202
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3203
2889
virtual int do_apply_event(Relay_log_info const *rli);
3204
2890
virtual int do_update_pos(Relay_log_info *rli);
3205
2891
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
3208
#ifndef DRIZZLE_CLIENT
3209
2893
Table *m_table;
3211
2894
char const *m_dbnam;
3212
2895
size_t m_dblen;
3213
2896
char const *m_tblnam;
3301
2984
void clear_flags(flag_set flags_arg) { m_flags &= ~flags_arg; }
3302
2985
flag_set get_flags(flag_set flags_arg) const { return m_flags & flags_arg; }
3304
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3305
2987
virtual void pack_info(Protocol *protocol);
3308
#ifdef DRIZZLE_CLIENT
3309
/* not for direct call, each derived has its own ::print() */
3310
virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info)= 0;
3313
#ifndef DRIZZLE_CLIENT
3314
2989
int add_row_data(uchar *data, size_t length)
3316
2991
return do_add_row_data(data,length);
3320
2994
/* Member functions to implement superclass interface */
3321
2995
virtual int get_data_size();
3324
2998
size_t get_width() const { return m_width; }
3325
2999
ulong get_table_id() const { return m_table_id; }
3327
#ifndef DRIZZLE_CLIENT
3328
3001
virtual bool write_data_header(IO_CACHE *file);
3329
3002
virtual bool write_data_body(IO_CACHE *file);
3330
3003
virtual const char *get_db() { return m_table->s->db.str; }
3333
3005
Check that malloc() succeeded in allocating memory for the rows
3334
3006
buffer and the COLS vector. Checking that an Update_rows_log_event
3347
3019
The constructors are protected since you're supposed to inherit
3348
3020
this class, not create instances of this class.
3350
#ifndef DRIZZLE_CLIENT
3351
3022
Rows_log_event(THD*, Table*, ulong table_id,
3352
3023
MY_BITMAP const *cols, bool is_transactional);
3354
3024
Rows_log_event(const char *row_data, uint event_len,
3355
3025
Log_event_type event_type,
3356
3026
const Format_description_log_event *description_event);
3358
#ifdef DRIZZLE_CLIENT
3359
void print_helper(FILE *, PRINT_EVENT_INFO *, char const *const name);
3362
#ifndef DRIZZLE_CLIENT
3363
3028
virtual int do_add_row_data(uchar *data, size_t length);
3366
#ifndef DRIZZLE_CLIENT
3367
3030
Table *m_table; /* The table the rows belong to */
3369
3031
ulong m_table_id; /* Table ID */
3370
3032
MY_BITMAP m_cols; /* Bitmap denoting columns available */
3371
3033
ulong m_width; /* The width of the columns bitmap */
3413
3074
ASSERT_OR_RETURN_ERROR(m_curr_row_end <= m_rows_end, HA_ERR_CORRUPT_EVENT);
3420
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3421
3080
virtual int do_apply_event(Relay_log_info const *rli);
3422
3081
virtual int do_update_pos(Relay_log_info *rli);
3423
3082
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
3495
3153
TYPE_CODE = WRITE_ROWS_EVENT
3498
#if !defined(DRIZZLE_CLIENT)
3499
3156
Write_rows_log_event(THD*, Table*, ulong table_id,
3500
3157
bool is_transactional);
3502
#ifdef HAVE_REPLICATION
3503
3158
Write_rows_log_event(const char *buf, uint event_len,
3504
3159
const Format_description_log_event *description_event);
3506
#if !defined(DRIZZLE_CLIENT)
3507
3160
static bool binlog_row_logging_function(THD *thd, Table *table,
3508
3161
bool is_transactional,
3509
3162
const uchar *before_record
3513
3166
return thd->binlog_write_row(table, is_transactional, after_record);
3518
3170
virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; }
3520
#ifdef DRIZZLE_CLIENT
3521
void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
3524
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3525
3172
virtual int do_before_row_operations(const Slave_reporting_capability *const);
3526
3173
virtual int do_after_row_operations(const Slave_reporting_capability *const,int);
3527
3174
virtual int do_exec_row(const Relay_log_info *const);
3550
3196
TYPE_CODE = UPDATE_ROWS_EVENT
3553
#ifndef DRIZZLE_CLIENT
3554
3199
Update_rows_log_event(THD*, Table*, ulong table_id,
3555
3200
bool is_transactional);
3557
3202
void init(MY_BITMAP const *cols);
3560
3204
virtual ~Update_rows_log_event();
3562
#ifdef HAVE_REPLICATION
3563
3206
Update_rows_log_event(const char *buf, uint event_len,
3564
3207
const Format_description_log_event *description_event);
3567
#if !defined(DRIZZLE_CLIENT)
3568
3209
static bool binlog_row_logging_function(THD *thd, Table *table,
3569
3210
bool is_transactional,
3570
3211
const uchar *before_record,
3584
3224
virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; }
3586
#ifdef DRIZZLE_CLIENT
3587
void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
3590
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3591
3226
virtual int do_before_row_operations(const Slave_reporting_capability *const);
3592
3227
virtual int do_after_row_operations(const Slave_reporting_capability *const,int);
3593
3228
virtual int do_exec_row(const Relay_log_info *const);
3594
#endif /* !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION) */
3623
3257
TYPE_CODE = DELETE_ROWS_EVENT
3626
#ifndef DRIZZLE_CLIENT
3627
3260
Delete_rows_log_event(THD*, Table*, ulong,
3628
3261
bool is_transactional);
3630
#ifdef HAVE_REPLICATION
3631
3262
Delete_rows_log_event(const char *buf, uint event_len,
3632
3263
const Format_description_log_event *description_event);
3634
#if !defined(DRIZZLE_CLIENT)
3635
3264
static bool binlog_row_logging_function(THD *thd, Table *table,
3636
3265
bool is_transactional,
3637
3266
const uchar *before_record,
3641
3270
return thd->binlog_delete_row(table, is_transactional, before_record);
3646
3274
virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; }
3648
#ifdef DRIZZLE_CLIENT
3649
void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
3652
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3653
3276
virtual int do_before_row_operations(const Slave_reporting_capability *const);
3654
3277
virtual int do_after_row_operations(const Slave_reporting_capability *const,int);
3655
3278
virtual int do_exec_row(const Relay_log_info *const);
3710
3331
m_message= msg;
3715
#ifndef DRIZZLE_CLIENT
3716
3335
void pack_info(Protocol*);
3719
3337
Incident_log_event(const char *buf, uint event_len,
3720
3338
const Format_description_log_event *descr_event);
3722
3340
virtual ~Incident_log_event();
3724
#ifdef DRIZZLE_CLIENT
3725
virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
3728
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3729
3342
virtual int do_apply_event(Relay_log_info const *rli);
3732
3344
virtual bool write_data_header(IO_CACHE *file);
3733
3345
virtual bool write_data_body(IO_CACHE *file);