~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/log_event.h

  • Committer: Brian Aker
  • Date: 2008-09-04 19:31:00 UTC
  • Revision ID: brian@tangent.org-20080904193100-l849hgghfy4urj43
Changing default character set from this point on.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems
5
 
 *
6
 
 *  This program is free software; you can redistribute it and/or modify
7
 
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation; version 2 of the License.
9
 
 *
10
 
 *  This program is distributed in the hope that it will be useful,
11
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 *  GNU General Public License for more details.
14
 
 *
15
 
 *  You should have received a copy of the GNU General Public License
16
 
 *  along with this program; if not, write to the Free Software
17
 
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 
 */
 
1
/* Copyright (C) 2000-2006 MySQL AB
 
2
 
 
3
   This program is free software; you can redistribute it and/or modify
 
4
   it under the terms of the GNU General Public License as published by
 
5
   the Free Software Foundation; version 2 of the License.
 
6
 
 
7
   This program is distributed in the hope that it will be useful,
 
8
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
   GNU General Public License for more details.
 
11
 
 
12
   You should have received a copy of the GNU General Public License
 
13
   along with this program; if not, write to the Free Software
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
19
15
 
20
16
/**
21
17
  @addtogroup Replication
29
25
*/
30
26
 
31
27
 
32
 
#ifndef DRIZZLED_LOG_EVENT_H
33
 
#define DRIZZLED_LOG_EVENT_H
34
 
 
35
 
 
36
 
#include <string>
 
28
#ifndef _log_event_h
 
29
#define _log_event_h
 
30
 
 
31
#if defined(USE_PRAGMA_INTERFACE) && !defined(DRIZZLE_CLIENT)
 
32
#pragma interface                       /* gcc class implementation */
 
33
#endif
 
34
 
37
35
#include <mysys/my_bitmap.h>
38
36
#include "rpl_constants.h"
 
37
#ifndef DRIZZLE_CLIENT
39
38
#include "rpl_record.h"
40
39
#include "rpl_reporting.h"
 
40
#else
 
41
#include "my_decimal.h"
 
42
#endif
41
43
 
42
44
#include <drizzled/sql_string.h>       /* append_query_string() needs String declaration */
43
45
 
159
161
  char opt_flags;
160
162
  char empty_flags;
161
163
 
162
 
  /* store in new format even if old is possible */
 
164
  // store in new format even if old is possible
163
165
  void force_new_format() { cached_new_format = 1;}
164
166
  int data_size()
165
167
  {
429
431
/**
430
432
  @def OPTIONS_WRITTEN_TO_BIN_LOG
431
433
 
432
 
  OPTIONS_WRITTEN_TO_BIN_LOG are the bits of session->options which must
 
434
  OPTIONS_WRITTEN_TO_BIN_LOG are the bits of thd->options which must
433
435
  be written to the binlog. OPTIONS_WRITTEN_TO_BIN_LOG could be
434
436
  written into the Format_description_log_event, so that if later we
435
437
  don't want to replicate a variable we did replicate, or the
436
438
  contrary, it's doable. But it should not be too hard to decide once
437
439
  for all of what we replicate and what we don't, among the fixed 32
438
 
  bits of session->options.
 
440
  bits of thd->options.
439
441
 
440
442
  I (Guilhem) have read through every option's usage, and it looks
441
443
  like OPTION_AUTO_IS_NULL and OPTION_NO_FOREIGN_KEYS are the only
453
455
 
454
456
/* Shouldn't be defined before */
455
457
#define EXPECTED_OPTIONS \
456
 
  ((1U << 14) | (1U << 26) | (1U << 27) | (1U << 19))
 
458
  ((1ULL << 14) | (1ULL << 26) | (1ULL << 27) | (1ULL << 19))
457
459
 
458
460
#if OPTIONS_WRITTEN_TO_BIN_LOG != EXPECTED_OPTIONS
459
461
#error OPTIONS_WRITTEN_TO_BIN_LOG must NOT change their values!
545
547
};
546
548
 
547
549
 
 
550
#ifndef DRIZZLE_CLIENT
548
551
class String;
549
552
class DRIZZLE_BIN_LOG;
550
 
class Session;
 
553
class THD;
 
554
#endif
551
555
 
552
556
class Format_description_log_event;
553
557
class Relay_log_info;
554
558
 
 
559
#ifdef DRIZZLE_CLIENT
 
560
enum enum_base64_output_mode {
 
561
  BASE64_OUTPUT_NEVER= 0,
 
562
  BASE64_OUTPUT_AUTO= 1,
 
563
  BASE64_OUTPUT_ALWAYS= 2,
 
564
  BASE64_OUTPUT_UNSPEC= 3,
 
565
  /* insert new output modes here */
 
566
  BASE64_OUTPUT_MODE_COUNT
 
567
};
 
568
 
 
569
/*
 
570
  A structure for mysqlbinlog to know how to print events
 
571
 
 
572
  This structure is passed to the event's print() methods,
 
573
 
 
574
  There are two types of settings stored here:
 
575
  1. Last db, flags2, sql_mode etc comes from the last printed event.
 
576
     They are stored so that only the necessary USE and SET commands
 
577
     are printed.
 
578
  2. Other information on how to print the events, e.g. short_form,
 
579
     hexdump_from.  These are not dependent on the last event.
 
580
*/
 
581
typedef struct st_print_event_info
 
582
{
 
583
  /*
 
584
    Settings for database, sql_mode etc that comes from the last event
 
585
    that was printed.  We cache these so that we don't have to print
 
586
    them if they are unchanged.
 
587
  */
 
588
  // TODO: have the last catalog here ??
 
589
  char db[FN_REFLEN+1]; // TODO: make this a LEX_STRING when thd->db is
 
590
  bool flags2_inited;
 
591
  uint32_t flags2;
 
592
  bool sql_mode_inited;
 
593
  ulong sql_mode;               /* must be same as THD.variables.sql_mode */
 
594
  ulong auto_increment_increment, auto_increment_offset;
 
595
  bool charset_inited;
 
596
  char charset[6]; // 3 variables, each of them storable in 2 bytes
 
597
  char time_zone_str[MAX_TIME_ZONE_NAME_LENGTH];
 
598
  uint32_t lc_time_names_number;
 
599
  uint charset_database_number;
 
600
  uint thread_id;
 
601
  bool thread_id_printed;
 
602
 
 
603
  st_print_event_info();
 
604
 
 
605
  ~st_print_event_info() {
 
606
    close_cached_file(&head_cache);
 
607
    close_cached_file(&body_cache);
 
608
  }
 
609
  bool init_ok() /* tells if construction was successful */
 
610
    { return my_b_inited(&head_cache) && my_b_inited(&body_cache); }
 
611
 
 
612
 
 
613
  /* Settings on how to print the events */
 
614
  bool short_form;
 
615
  enum_base64_output_mode base64_output_mode;
 
616
  /*
 
617
    This is set whenever a Format_description_event is printed.
 
618
    Later, when an event is printed in base64, this flag is tested: if
 
619
    no Format_description_event has been seen, it is unsafe to print
 
620
    the base64 event, so an error message is generated.
 
621
  */
 
622
  bool printed_fd_event;
 
623
  my_off_t hexdump_from;
 
624
  uint8_t common_header_len;
 
625
  char delimiter[16];
 
626
 
 
627
  /*
 
628
     These two caches are used by the row-based replication events to
 
629
     collect the header information and the main body of the events
 
630
     making up a statement.
 
631
   */
 
632
  IO_CACHE head_cache;
 
633
  IO_CACHE body_cache;
 
634
} PRINT_EVENT_INFO;
 
635
#endif
 
636
 
555
637
/**
556
638
  the struct aggregates two paramenters that identify an event
557
639
  uniquely in scope of communication of a particular master and slave couple.
744
826
    sees the offset of the BEGIN, which is logical as rollback may
745
827
    occur), except the COMMIT query which has its real offset.
746
828
  */
747
 
  off_t log_pos;
 
829
  my_off_t log_pos;
748
830
  /*
749
831
     A temp buffer for read_log_event; it is later analysed according to the
750
832
     event's type, and its content is distributed in the event-specific fields.
785
867
  */
786
868
  ulong slave_exec_mode;
787
869
 
788
 
  Session* session;
 
870
#ifndef DRIZZLE_CLIENT
 
871
  THD* thd;
789
872
 
790
873
  Log_event();
791
 
  Log_event(Session* session_arg, uint16_t flags_arg, bool cache_stmt);
 
874
  Log_event(THD* thd_arg, uint16_t flags_arg, bool cache_stmt);
792
875
  /*
793
876
    read_log_event() functions read an event from a binlog or relay
794
877
    log; used by SHOW BINLOG EVENTS, the binlog_dump thread on the
812
895
    EVENTS.
813
896
  */
814
897
  static void init_show_field_list(List<Item>* field_list);
 
898
#ifdef HAVE_REPLICATION
815
899
  int net_send(Protocol *protocol, const char* log_name, my_off_t pos);
816
900
 
817
901
  /*
821
905
 
822
906
  virtual void pack_info(Protocol *protocol);
823
907
 
 
908
#endif /* HAVE_REPLICATION */
824
909
  virtual const char* get_db()
825
910
  {
826
 
    return session ? session->db : 0;
 
911
    return thd ? thd->db : 0;
827
912
  }
 
913
#else
 
914
  Log_event() : temp_buf(0) {}
 
915
    /* avoid having to link mysqlbinlog against libpthread */
 
916
  static Log_event* read_log_event(IO_CACHE* file,
 
917
                                   const Format_description_log_event
 
918
                                   *description_event);
 
919
  /* print*() functions are used by mysqlbinlog */
 
920
  virtual void print(FILE* file, PRINT_EVENT_INFO* print_event_info) = 0;
 
921
  void print_timestamp(IO_CACHE* file, time_t *ts = 0);
 
922
  void print_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info,
 
923
                    bool is_more);
 
924
  void print_base64(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info,
 
925
                    bool is_more);
 
926
#endif
828
927
 
829
928
  static void *operator new(size_t size)
830
929
  {
832
931
  }
833
932
 
834
933
  static void operator delete(void *ptr,
835
 
                              size_t)
 
934
                              size_t size __attribute__((unused)))
836
935
  {
837
 
    free((unsigned char*) ptr);
 
936
    my_free((uchar*) ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR));
838
937
  }
839
938
 
840
939
  /* Placement version of the above operators */
841
940
  static void *operator new(size_t, void* ptr) { return ptr; }
842
941
  static void operator delete(void*, void*) { }
843
942
 
 
943
#ifndef DRIZZLE_CLIENT
844
944
  bool write_header(IO_CACHE* file, ulong data_length);
845
945
  virtual bool write(IO_CACHE* file)
846
946
  {
848
948
            write_data_header(file) ||
849
949
            write_data_body(file));
850
950
  }
851
 
  virtual bool write_data_header(IO_CACHE*)
 
951
  virtual bool write_data_header(IO_CACHE* file __attribute__((unused)))
852
952
  { return 0; }
853
 
  virtual bool write_data_body(IO_CACHE*)
 
953
  virtual bool write_data_body(IO_CACHE* file __attribute__((unused)))
854
954
  { return 0; }
855
955
  inline time_t get_time()
856
956
  {
857
 
    Session *tmp_session;
 
957
    THD *tmp_thd;
858
958
    if (when)
859
959
      return when;
860
 
    if (session)
861
 
      return session->start_time;
862
 
    if ((tmp_session= current_session))
863
 
      return tmp_session->start_time;
 
960
    if (thd)
 
961
      return thd->start_time;
 
962
    if ((tmp_thd= current_thd))
 
963
      return tmp_thd->start_time;
864
964
    return my_time(0);
865
965
  }
 
966
#endif
866
967
  virtual Log_event_type get_type_code() = 0;
867
968
  virtual bool is_valid() const = 0;
868
969
  virtual bool is_artificial_event() { return 0; }
875
976
  {
876
977
    if (temp_buf)
877
978
    {
878
 
      free(temp_buf);
 
979
      my_free(temp_buf, MYF(0));
879
980
      temp_buf = 0;
880
981
    }
881
982
  }
884
985
    is calculated during write()
885
986
  */
886
987
  virtual int get_data_size() { return 0;}
887
 
  static Log_event* read_log_event(const char* buf, uint32_t event_len,
 
988
  static Log_event* read_log_event(const char* buf, uint event_len,
888
989
                                   const char **error,
889
990
                                   const Format_description_log_event
890
991
                                   *description_event);
899
1000
 
900
1001
  /* Return start of query time or current time */
901
1002
 
 
1003
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
902
1004
public:
903
1005
 
904
1006
  /**
975
1077
    @retval 0     Event applied successfully
976
1078
    @retval errno Error code if event application failed
977
1079
  */
978
 
  virtual int do_apply_event(Relay_log_info const *)
 
1080
  virtual int do_apply_event(Relay_log_info const *rli __attribute__((unused)))
979
1081
  {
980
1082
    return 0;                /* Default implementation does nothing */
981
1083
  }
1037
1139
     non-zero. The caller shall decrease the counter by one.
1038
1140
   */
1039
1141
  virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
 
1142
#endif
1040
1143
};
1041
1144
 
1042
1145
 
1179
1282
    <td>flags2</td>
1180
1283
    <td>Q_FLAGS2_CODE == 0</td>
1181
1284
    <td>4 byte bitfield</td>
1182
 
    <td>The flags in @c session->options, binary AND-ed with @c
1183
 
    OPTIONS_WRITTEN_TO_BIN_LOG.  The @c session->options bitfield contains
 
1285
    <td>The flags in @c thd->options, binary AND-ed with @c
 
1286
    OPTIONS_WRITTEN_TO_BIN_LOG.  The @c thd->options bitfield contains
1184
1287
    options for "SELECT".  @c OPTIONS_WRITTEN identifies those options
1185
1288
    that need to be written to the binlog (not all do).  Specifically,
1186
1289
    @c OPTIONS_WRITTEN_TO_BIN_LOG equals (@c OPTION_AUTO_IS_NULL | @c
1337
1440
    <td>2 byte integer</td>
1338
1441
 
1339
1442
    <td>The value of the collation_database system variable (in the
1340
 
    source code stored in @c session->variables.collation_database), which
 
1443
    source code stored in @c thd->variables.collation_database), which
1341
1444
    holds the code for a (character set, collation) pair as described
1342
1445
    above (see Q_CHARSET_CODE).
1343
1446
 
1404
1507
    concerned) from here.
1405
1508
  */
1406
1509
 
1407
 
  uint32_t catalog_len;                 // <= 255 char; 0 means uninited
 
1510
  uint catalog_len;                     // <= 255 char; 0 means uninited
1408
1511
 
1409
1512
  /*
1410
1513
    We want to be able to store a variable number of N-bit status vars:
1430
1533
 
1431
1534
  /*
1432
1535
    'flags2' is a second set of flags (on top of those in Log_event), for
1433
 
    session variables. These are session->options which is & against a mask
 
1536
    session variables. These are thd->options which is & against a mask
1434
1537
    (OPTIONS_WRITTEN_TO_BIN_LOG).
1435
1538
    flags2_inited helps make a difference between flags2==0 (3.23 or 4.x
1436
1539
    master, we don't know flags2, so use the slave server's global options) and
1446
1549
  ulong sql_mode;
1447
1550
  ulong auto_increment_increment, auto_increment_offset;
1448
1551
  char charset[6];
1449
 
  uint32_t time_zone_len; /* 0 means uninited */
 
1552
  uint time_zone_len; /* 0 means uninited */
1450
1553
  const char *time_zone_str;
1451
 
  uint32_t lc_time_names_number; /* 0 means en_US */
1452
 
  uint32_t charset_database_number;
1453
 
 
1454
 
 
1455
 
  Query_log_event(Session* session_arg, const char* query_arg, ulong query_length,
 
1554
  uint lc_time_names_number; /* 0 means en_US */
 
1555
  uint charset_database_number;
 
1556
 
 
1557
#ifndef DRIZZLE_CLIENT
 
1558
 
 
1559
  Query_log_event(THD* thd_arg, const char* query_arg, ulong query_length,
1456
1560
                  bool using_trans, bool suppress_use,
1457
 
                  Session::killed_state killed_err_arg= Session::KILLED_NO_VALUE);
 
1561
                  THD::killed_state killed_err_arg= THD::KILLED_NO_VALUE);
1458
1562
  const char* get_db() { return db; }
 
1563
#ifdef HAVE_REPLICATION
1459
1564
  void pack_info(Protocol* protocol);
 
1565
#endif /* HAVE_REPLICATION */
 
1566
#else
 
1567
  void print_query_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info);
 
1568
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
 
1569
#endif
1460
1570
 
1461
1571
  Query_log_event();
1462
 
  Query_log_event(const char* buf, uint32_t event_len,
 
1572
  Query_log_event(const char* buf, uint event_len,
1463
1573
                  const Format_description_log_event *description_event,
1464
1574
                  Log_event_type event_type);
1465
1575
  ~Query_log_event()
1466
1576
  {
1467
1577
    if (data_buf)
1468
 
      free((unsigned char*) data_buf);
 
1578
      my_free((uchar*) data_buf, MYF(0));
1469
1579
  }
1470
1580
  Log_event_type get_type_code() { return QUERY_EVENT; }
 
1581
#ifndef DRIZZLE_CLIENT
1471
1582
  bool write(IO_CACHE* file);
1472
 
  virtual bool write_post_header_for_derived(IO_CACHE*)
 
1583
  virtual bool write_post_header_for_derived(IO_CACHE* file __attribute__((unused)))
1473
1584
  { return false; }
 
1585
#endif
1474
1586
  bool is_valid() const { return query != 0; }
1475
1587
 
1476
1588
  /*
1481
1593
  /* Writes derived event-specific part of post header. */
1482
1594
 
1483
1595
public:        /* !!! Public in this patch to allow old usage */
 
1596
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
1484
1597
  virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
1485
1598
  virtual int do_apply_event(Relay_log_info const *rli);
1486
1599
  virtual int do_update_pos(Relay_log_info *rli);
1488
1601
  int do_apply_event(Relay_log_info const *rli,
1489
1602
                       const char *query_arg,
1490
1603
                       uint32_t q_len_arg);
 
1604
#endif /* HAVE_REPLICATION */
1491
1605
};
1492
1606
 
1493
1607
 
 
1608
#ifdef HAVE_REPLICATION
 
1609
 
1494
1610
/**
1495
1611
  @class Slave_log_event
1496
1612
 
1539
1655
  </tr>
1540
1656
  </table>
1541
1657
*/
1542
 
 
1543
1658
class Slave_log_event: public Log_event
1544
1659
{
1545
1660
protected:
1546
1661
  char* mem_pool;
1547
 
  void init_from_mem_pool();
 
1662
  void init_from_mem_pool(int data_size);
1548
1663
public:
1549
 
  off_t master_pos;
1550
 
  std::string master_host;
1551
 
  std::string master_log;
 
1664
  my_off_t master_pos;
 
1665
  char* master_host;
 
1666
  char* master_log;
 
1667
  int master_host_len;
 
1668
  int master_log_len;
1552
1669
  uint16_t master_port;
1553
1670
 
1554
 
  Slave_log_event(Session* session_arg, Relay_log_info* rli);
 
1671
#ifndef DRIZZLE_CLIENT
 
1672
  Slave_log_event(THD* thd_arg, Relay_log_info* rli);
1555
1673
  void pack_info(Protocol* protocol);
 
1674
#else
 
1675
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
 
1676
#endif
1556
1677
 
1557
 
  Slave_log_event(const char* buf, uint32_t event_len);
 
1678
  Slave_log_event(const char* buf, uint event_len);
1558
1679
  ~Slave_log_event();
1559
1680
  int get_data_size();
1560
 
  bool is_valid() const { return master_host.length() != 0; }
 
1681
  bool is_valid() const { return master_host != 0; }
1561
1682
  Log_event_type get_type_code() { return SLAVE_EVENT; }
 
1683
#ifndef DRIZZLE_CLIENT
1562
1684
  bool write(IO_CACHE* file);
 
1685
#endif
1563
1686
 
1564
1687
private:
 
1688
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
1565
1689
  virtual int do_apply_event(Relay_log_info const* rli);
 
1690
#endif
1566
1691
};
1567
1692
 
 
1693
#endif /* HAVE_REPLICATION */
 
1694
 
1568
1695
 
1569
1696
/**
1570
1697
  @class Load_log_event
1768
1895
class Load_log_event: public Log_event
1769
1896
{
1770
1897
private:
1771
 
  uint32_t get_query_buffer_length();
 
1898
  uint get_query_buffer_length();
1772
1899
  void print_query(bool need_db, char *buf, char **end,
1773
1900
                   char **fn_start, char **fn_end);
1774
1901
protected:
1789
1916
  uint32_t fname_len;
1790
1917
  uint32_t num_fields;
1791
1918
  const char* fields;
1792
 
  const unsigned char* field_lens;
 
1919
  const uchar* field_lens;
1793
1920
  uint32_t field_block_len;
1794
1921
 
1795
1922
  const char* table_name;
1800
1927
  bool local_fname;
1801
1928
 
1802
1929
  /* fname doesn't point to memory inside Log_event::temp_buf  */
1803
 
  void set_fname_outside_temp_buf(const char *afname, uint32_t alen)
 
1930
  void set_fname_outside_temp_buf(const char *afname, uint alen)
1804
1931
  {
1805
1932
    fname= afname;
1806
1933
    fname_len= alen;
1812
1939
    return local_fname;
1813
1940
  }
1814
1941
 
 
1942
#ifndef DRIZZLE_CLIENT
1815
1943
  String field_lens_buf;
1816
1944
  String fields_buf;
1817
1945
 
1818
 
  Load_log_event(Session* session, sql_exchange* ex, const char* db_arg,
 
1946
  Load_log_event(THD* thd, sql_exchange* ex, const char* db_arg,
1819
1947
                 const char* table_name_arg,
1820
1948
                 List<Item>& fields_arg, enum enum_duplicates handle_dup, bool ignore,
1821
1949
                 bool using_trans);
1822
1950
  void set_fields(const char* db, List<Item> &fields_arg,
1823
1951
                  Name_resolution_context *context);
1824
1952
  const char* get_db() { return db; }
 
1953
#ifdef HAVE_REPLICATION
1825
1954
  void pack_info(Protocol* protocol);
 
1955
#endif /* HAVE_REPLICATION */
 
1956
#else
 
1957
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
 
1958
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info, bool commented);
 
1959
#endif
1826
1960
 
1827
1961
  /*
1828
1962
    Note that for all the events related to LOAD DATA (Load_log_event,
1830
1964
    logging of LOAD DATA is going to be changed in 4.1 or 5.0, this is only used
1831
1965
    for the common_header_len (post_header_len will not be changed).
1832
1966
  */
1833
 
  Load_log_event(const char* buf, uint32_t event_len,
 
1967
  Load_log_event(const char* buf, uint event_len,
1834
1968
                 const Format_description_log_event* description_event);
1835
1969
  ~Load_log_event()
1836
1970
  {}
1838
1972
  {
1839
1973
    return sql_ex.new_format() ? NEW_LOAD_EVENT: LOAD_EVENT;
1840
1974
  }
 
1975
#ifndef DRIZZLE_CLIENT
1841
1976
  bool write_data_header(IO_CACHE* file);
1842
1977
  bool write_data_body(IO_CACHE* file);
 
1978
#endif
1843
1979
  bool is_valid() const { return table_name != 0; }
1844
1980
  int get_data_size()
1845
1981
  {
1849
1985
  }
1850
1986
 
1851
1987
public:        /* !!! Public in this patch to allow old usage */
 
1988
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
1852
1989
  virtual int do_apply_event(Relay_log_info const* rli)
1853
1990
  {
1854
 
    return do_apply_event(session->slave_net,rli,0);
 
1991
    return do_apply_event(thd->slave_net,rli,0);
1855
1992
  }
1856
1993
 
1857
1994
  int do_apply_event(NET *net, Relay_log_info const *rli,
1858
1995
                     bool use_rli_only_for_errors);
 
1996
#endif
1859
1997
};
1860
1998
 
1861
1999
extern char server_version[SERVER_VERSION_LENGTH];
1915
2053
  */
1916
2054
  bool dont_set_created;
1917
2055
 
 
2056
#ifndef DRIZZLE_CLIENT
1918
2057
  Start_log_event_v3();
 
2058
#ifdef HAVE_REPLICATION
1919
2059
  void pack_info(Protocol* protocol);
 
2060
#endif /* HAVE_REPLICATION */
 
2061
#else
 
2062
  Start_log_event_v3() {}
 
2063
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
 
2064
#endif
1920
2065
 
1921
2066
  Start_log_event_v3(const char* buf,
1922
2067
                     const Format_description_log_event* description_event);
1923
2068
  ~Start_log_event_v3() {}
1924
2069
  Log_event_type get_type_code() { return START_EVENT_V3;}
 
2070
#ifndef DRIZZLE_CLIENT
1925
2071
  bool write(IO_CACHE* file);
 
2072
#endif
1926
2073
  bool is_valid() const { return 1; }
1927
2074
  int get_data_size()
1928
2075
  {
1931
2078
  virtual bool is_artificial_event() { return artificial_event; }
1932
2079
 
1933
2080
protected:
 
2081
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
1934
2082
  virtual int do_apply_event(Relay_log_info const *rli);
1935
2083
  virtual enum_skip_reason do_shall_skip(Relay_log_info*)
1936
2084
  {
1943
2091
    else
1944
2092
      return Log_event::EVENT_SKIP_NOT;
1945
2093
  }
 
2094
#endif
1946
2095
};
1947
2096
 
1948
2097
 
1969
2118
  uint8_t number_of_event_types;
1970
2119
  /* The list of post-headers' lengthes */
1971
2120
  uint8_t *post_header_len;
1972
 
  unsigned char server_version_split[3];
 
2121
  uchar server_version_split[3];
1973
2122
  const uint8_t *event_type_permutation;
1974
2123
 
1975
2124
  Format_description_log_event(uint8_t binlog_ver, const char* server_ver=0);
1976
 
  Format_description_log_event(const char* buf, uint32_t event_len,
 
2125
  Format_description_log_event(const char* buf, uint event_len,
1977
2126
                               const Format_description_log_event
1978
2127
                               *description_event);
1979
2128
  ~Format_description_log_event()
1980
2129
  {
1981
 
    free((unsigned char*)post_header_len);
 
2130
    my_free((uchar*)post_header_len, MYF(MY_ALLOW_ZERO_PTR));
1982
2131
  }
1983
2132
  Log_event_type get_type_code() { return FORMAT_DESCRIPTION_EVENT;}
 
2133
#ifndef DRIZZLE_CLIENT
1984
2134
  bool write(IO_CACHE* file);
 
2135
#endif
1985
2136
  bool is_valid() const
1986
2137
  {
1987
2138
    return ((common_header_len >= ((binlog_version==1) ? OLD_HEADER_LEN :
2001
2152
  void calc_server_version_split();
2002
2153
 
2003
2154
protected:
 
2155
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2004
2156
  virtual int do_apply_event(Relay_log_info const *rli);
2005
2157
  virtual int do_update_pos(Relay_log_info *rli);
2006
2158
  virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
 
2159
#endif
2007
2160
};
2008
2161
 
2009
2162
 
2048
2201
{
2049
2202
public:
2050
2203
  uint64_t val;
2051
 
  unsigned char type;
 
2204
  uchar type;
2052
2205
 
2053
 
  Intvar_log_event(Session* session_arg,unsigned char type_arg, uint64_t val_arg)
2054
 
    :Log_event(session_arg,0,0),val(val_arg),type(type_arg)
 
2206
#ifndef DRIZZLE_CLIENT
 
2207
  Intvar_log_event(THD* thd_arg,uchar type_arg, uint64_t val_arg)
 
2208
    :Log_event(thd_arg,0,0),val(val_arg),type(type_arg)
2055
2209
  {}
 
2210
#ifdef HAVE_REPLICATION
2056
2211
  void pack_info(Protocol* protocol);
 
2212
#endif /* HAVE_REPLICATION */
 
2213
#else
 
2214
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
 
2215
#endif
2057
2216
 
2058
2217
  Intvar_log_event(const char* buf,
2059
2218
                   const Format_description_log_event *description_event);
2061
2220
  Log_event_type get_type_code() { return INTVAR_EVENT;}
2062
2221
  const char* get_var_type_name();
2063
2222
  int get_data_size() { return  9; /* sizeof(type) + sizeof(val) */;}
 
2223
#ifndef DRIZZLE_CLIENT
2064
2224
  bool write(IO_CACHE* file);
 
2225
#endif
2065
2226
  bool is_valid() const { return 1; }
2066
2227
 
2067
2228
private:
 
2229
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2068
2230
  virtual int do_apply_event(Relay_log_info const *rli);
2069
2231
  virtual int do_update_pos(Relay_log_info *rli);
2070
2232
  virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
 
2233
#endif
2071
2234
};
2072
2235
 
2073
2236
 
2115
2278
  uint64_t seed1;
2116
2279
  uint64_t seed2;
2117
2280
 
2118
 
  Rand_log_event(Session* session_arg, uint64_t seed1_arg, uint64_t seed2_arg)
2119
 
    :Log_event(session_arg,0,0),seed1(seed1_arg),seed2(seed2_arg)
 
2281
#ifndef DRIZZLE_CLIENT
 
2282
  Rand_log_event(THD* thd_arg, uint64_t seed1_arg, uint64_t seed2_arg)
 
2283
    :Log_event(thd_arg,0,0),seed1(seed1_arg),seed2(seed2_arg)
2120
2284
  {}
 
2285
#ifdef HAVE_REPLICATION
2121
2286
  void pack_info(Protocol* protocol);
 
2287
#endif /* HAVE_REPLICATION */
 
2288
#else
 
2289
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
 
2290
#endif
2122
2291
 
2123
2292
  Rand_log_event(const char* buf,
2124
2293
                 const Format_description_log_event *description_event);
2125
2294
  ~Rand_log_event() {}
2126
2295
  Log_event_type get_type_code() { return RAND_EVENT;}
2127
2296
  int get_data_size() { return 16; /* sizeof(uint64_t) * 2*/ }
 
2297
#ifndef DRIZZLE_CLIENT
2128
2298
  bool write(IO_CACHE* file);
 
2299
#endif
2129
2300
  bool is_valid() const { return 1; }
2130
2301
 
2131
2302
private:
 
2303
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2132
2304
  virtual int do_apply_event(Relay_log_info const *rli);
2133
2305
  virtual int do_update_pos(Relay_log_info *rli);
2134
2306
  virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
 
2307
#endif
2135
2308
};
2136
2309
 
2137
2310
/**
2142
2315
 
2143
2316
  @section Xid_log_event_binary_format Binary Format  
2144
2317
*/
 
2318
#ifdef DRIZZLE_CLIENT
 
2319
typedef uint64_t my_xid; // this line is the same as in handler.h
 
2320
#endif
 
2321
 
2145
2322
class Xid_log_event: public Log_event
2146
2323
{
2147
2324
 public:
2148
2325
   my_xid xid;
2149
2326
 
2150
 
  Xid_log_event(Session* session_arg, my_xid x): Log_event(session_arg,0,0), xid(x) {}
 
2327
#ifndef DRIZZLE_CLIENT
 
2328
  Xid_log_event(THD* thd_arg, my_xid x): Log_event(thd_arg,0,0), xid(x) {}
 
2329
#ifdef HAVE_REPLICATION
2151
2330
  void pack_info(Protocol* protocol);
 
2331
#endif /* HAVE_REPLICATION */
 
2332
#else
 
2333
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
 
2334
#endif
2152
2335
 
2153
2336
  Xid_log_event(const char* buf,
2154
2337
                const Format_description_log_event *description_event);
2155
2338
  ~Xid_log_event() {}
2156
2339
  Log_event_type get_type_code() { return XID_EVENT;}
2157
2340
  int get_data_size() { return sizeof(xid); }
 
2341
#ifndef DRIZZLE_CLIENT
2158
2342
  bool write(IO_CACHE* file);
 
2343
#endif
2159
2344
  bool is_valid() const { return 1; }
2160
2345
 
2161
2346
private:
 
2347
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2162
2348
  virtual int do_apply_event(Relay_log_info const *rli);
2163
2349
  enum_skip_reason do_shall_skip(Relay_log_info *rli);
 
2350
#endif
2164
2351
};
2165
2352
 
2166
2353
/**
2176
2363
{
2177
2364
public:
2178
2365
  char *name;
2179
 
  uint32_t name_len;
 
2366
  uint name_len;
2180
2367
  char *val;
2181
2368
  ulong val_len;
2182
2369
  Item_result type;
2183
 
  uint32_t charset_number;
 
2370
  uint charset_number;
2184
2371
  bool is_null;
2185
 
  User_var_log_event(Session*,
2186
 
                     char *name_arg, uint32_t name_len_arg,
 
2372
#ifndef DRIZZLE_CLIENT
 
2373
  User_var_log_event(THD* thd_arg __attribute__((unused)),
 
2374
                     char *name_arg, uint name_len_arg,
2187
2375
                     char *val_arg, ulong val_len_arg, Item_result type_arg,
2188
 
                     uint32_t charset_number_arg)
 
2376
                     uint charset_number_arg)
2189
2377
    :Log_event(), name(name_arg), name_len(name_len_arg), val(val_arg),
2190
2378
    val_len(val_len_arg), type(type_arg), charset_number(charset_number_arg)
2191
2379
    { is_null= !val; }
2192
2380
  void pack_info(Protocol* protocol);
 
2381
#else
 
2382
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
 
2383
#endif
2193
2384
 
2194
2385
  User_var_log_event(const char* buf,
2195
2386
                     const Format_description_log_event *description_event);
2196
2387
  ~User_var_log_event() {}
2197
2388
  Log_event_type get_type_code() { return USER_VAR_EVENT;}
 
2389
#ifndef DRIZZLE_CLIENT
2198
2390
  bool write(IO_CACHE* file);
 
2391
#endif
2199
2392
  bool is_valid() const { return 1; }
2200
2393
 
2201
2394
private:
 
2395
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2202
2396
  virtual int do_apply_event(Relay_log_info const *rli);
2203
2397
  virtual int do_update_pos(Relay_log_info *rli);
2204
2398
  virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
 
2399
#endif
2205
2400
};
2206
2401
 
2207
2402
 
2216
2411
class Stop_log_event: public Log_event
2217
2412
{
2218
2413
public:
 
2414
#ifndef DRIZZLE_CLIENT
2219
2415
  Stop_log_event() :Log_event()
2220
2416
  {}
 
2417
#else
 
2418
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
 
2419
#endif
2221
2420
 
2222
2421
  Stop_log_event(const char* buf,
2223
2422
                 const Format_description_log_event *description_event):
2228
2427
  bool is_valid() const { return 1; }
2229
2428
 
2230
2429
private:
 
2430
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2231
2431
  virtual int do_update_pos(Relay_log_info *rli);
2232
 
  virtual enum_skip_reason do_shall_skip(Relay_log_info *)
 
2432
  virtual enum_skip_reason do_shall_skip(Relay_log_info *rli __attribute__((unused)))
2233
2433
  {
2234
2434
    /*
2235
2435
      Events from ourself should be skipped, but they should not
2240
2440
    else
2241
2441
      return Log_event::EVENT_SKIP_NOT;
2242
2442
  }
 
2443
#endif
2243
2444
};
2244
2445
 
2245
2446
/**
2299
2500
  };
2300
2501
  const char* new_log_ident;
2301
2502
  uint64_t pos;
2302
 
  uint32_t ident_len;
2303
 
  uint32_t flags;
 
2503
  uint ident_len;
 
2504
  uint flags;
 
2505
#ifndef DRIZZLE_CLIENT
2304
2506
  Rotate_log_event(const char* new_log_ident_arg,
2305
 
                   uint32_t ident_len_arg,
2306
 
                   uint64_t pos_arg, uint32_t flags);
 
2507
                   uint ident_len_arg,
 
2508
                   uint64_t pos_arg, uint flags);
 
2509
#ifdef HAVE_REPLICATION
2307
2510
  void pack_info(Protocol* protocol);
 
2511
#endif /* HAVE_REPLICATION */
 
2512
#else
 
2513
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
 
2514
#endif
2308
2515
 
2309
 
  Rotate_log_event(const char* buf, uint32_t event_len,
 
2516
  Rotate_log_event(const char* buf, uint event_len,
2310
2517
                   const Format_description_log_event* description_event);
2311
2518
  ~Rotate_log_event()
2312
2519
  {
2313
2520
    if (flags & DUP_NAME)
2314
 
      free((unsigned char*) new_log_ident);
 
2521
      my_free((uchar*) new_log_ident, MYF(MY_ALLOW_ZERO_PTR));
2315
2522
  }
2316
2523
  Log_event_type get_type_code() { return ROTATE_EVENT;}
2317
2524
  int get_data_size() { return  ident_len + ROTATE_HEADER_LEN;}
2318
2525
  bool is_valid() const { return new_log_ident != 0; }
 
2526
#ifndef DRIZZLE_CLIENT
2319
2527
  bool write(IO_CACHE* file);
 
2528
#endif
2320
2529
 
2321
2530
private:
 
2531
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2322
2532
  virtual int do_update_pos(Relay_log_info *rli);
2323
2533
  virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
 
2534
#endif
2324
2535
};
2325
2536
 
2326
2537
 
2342
2553
  */
2343
2554
  bool fake_base;
2344
2555
public:
2345
 
  unsigned char* block;
 
2556
  uchar* block;
2346
2557
  const char *event_buf;
2347
 
  uint32_t block_len;
2348
 
  uint32_t file_id;
 
2558
  uint block_len;
 
2559
  uint file_id;
2349
2560
  bool inited_from_old;
2350
2561
 
2351
 
  Create_file_log_event(Session* session, sql_exchange* ex, const char* db_arg,
 
2562
#ifndef DRIZZLE_CLIENT
 
2563
  Create_file_log_event(THD* thd, sql_exchange* ex, const char* db_arg,
2352
2564
                        const char* table_name_arg,
2353
2565
                        List<Item>& fields_arg,
2354
2566
                        enum enum_duplicates handle_dup, bool ignore,
2355
 
                        unsigned char* block_arg, uint32_t block_len_arg,
 
2567
                        uchar* block_arg, uint block_len_arg,
2356
2568
                        bool using_trans);
 
2569
#ifdef HAVE_REPLICATION
2357
2570
  void pack_info(Protocol* protocol);
 
2571
#endif /* HAVE_REPLICATION */
 
2572
#else
 
2573
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
 
2574
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info,
 
2575
             bool enable_local);
 
2576
#endif
2358
2577
 
2359
 
  Create_file_log_event(const char* buf, uint32_t event_len,
 
2578
  Create_file_log_event(const char* buf, uint event_len,
2360
2579
                        const Format_description_log_event* description_event);
2361
2580
  ~Create_file_log_event()
2362
2581
  {
2363
 
    free((char*) event_buf);
 
2582
    my_free((char*) event_buf, MYF(MY_ALLOW_ZERO_PTR));
2364
2583
  }
2365
2584
 
2366
2585
  Log_event_type get_type_code()
2374
2593
            4 + 1 + block_len);
2375
2594
  }
2376
2595
  bool is_valid() const { return inited_from_old || block != 0; }
 
2596
#ifndef DRIZZLE_CLIENT
2377
2597
  bool write_data_header(IO_CACHE* file);
2378
2598
  bool write_data_body(IO_CACHE* file);
2379
2599
  /*
2381
2601
    write it as Load event - used on the slave
2382
2602
  */
2383
2603
  bool write_base(IO_CACHE* file);
 
2604
#endif
2384
2605
 
2385
2606
private:
 
2607
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2386
2608
  virtual int do_apply_event(Relay_log_info const *rli);
 
2609
#endif
2387
2610
};
2388
2611
 
2389
2612
 
2396
2619
class Append_block_log_event: public Log_event
2397
2620
{
2398
2621
public:
2399
 
  unsigned char* block;
2400
 
  uint32_t block_len;
2401
 
  uint32_t file_id;
 
2622
  uchar* block;
 
2623
  uint block_len;
 
2624
  uint file_id;
2402
2625
  /*
2403
2626
    'db' is filled when the event is created in mysql_load() (the
2404
2627
    event needs to have a 'db' member to be well filtered by
2412
2635
  */
2413
2636
  const char* db;
2414
2637
 
2415
 
  Append_block_log_event(Session* session, const char* db_arg, unsigned char* block_arg,
2416
 
                         uint32_t block_len_arg, bool using_trans);
 
2638
#ifndef DRIZZLE_CLIENT
 
2639
  Append_block_log_event(THD* thd, const char* db_arg, uchar* block_arg,
 
2640
                         uint block_len_arg, bool using_trans);
 
2641
#ifdef HAVE_REPLICATION
2417
2642
  void pack_info(Protocol* protocol);
2418
2643
  virtual int get_create_or_append() const;
 
2644
#endif /* HAVE_REPLICATION */
 
2645
#else
 
2646
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
 
2647
#endif
2419
2648
 
2420
 
  Append_block_log_event(const char* buf, uint32_t event_len,
 
2649
  Append_block_log_event(const char* buf, uint event_len,
2421
2650
                         const Format_description_log_event
2422
2651
                         *description_event);
2423
2652
  ~Append_block_log_event() {}
2424
2653
  Log_event_type get_type_code() { return APPEND_BLOCK_EVENT;}
2425
2654
  int get_data_size() { return  block_len + APPEND_BLOCK_HEADER_LEN ;}
2426
2655
  bool is_valid() const { return block != 0; }
 
2656
#ifndef DRIZZLE_CLIENT
2427
2657
  bool write(IO_CACHE* file);
2428
2658
  const char* get_db() { return db; }
 
2659
#endif
2429
2660
 
2430
2661
private:
 
2662
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2431
2663
  virtual int do_apply_event(Relay_log_info const *rli);
 
2664
#endif
2432
2665
};
2433
2666
 
2434
2667
 
2441
2674
class Delete_file_log_event: public Log_event
2442
2675
{
2443
2676
public:
2444
 
  uint32_t file_id;
 
2677
  uint file_id;
2445
2678
  const char* db; /* see comment in Append_block_log_event */
2446
2679
 
2447
 
  Delete_file_log_event(Session* session, const char* db_arg, bool using_trans);
 
2680
#ifndef DRIZZLE_CLIENT
 
2681
  Delete_file_log_event(THD* thd, const char* db_arg, bool using_trans);
 
2682
#ifdef HAVE_REPLICATION
2448
2683
  void pack_info(Protocol* protocol);
 
2684
#endif /* HAVE_REPLICATION */
 
2685
#else
 
2686
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
 
2687
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info,
 
2688
             bool enable_local);
 
2689
#endif
2449
2690
 
2450
 
  Delete_file_log_event(const char* buf, uint32_t event_len,
 
2691
  Delete_file_log_event(const char* buf, uint event_len,
2451
2692
                        const Format_description_log_event* description_event);
2452
2693
  ~Delete_file_log_event() {}
2453
2694
  Log_event_type get_type_code() { return DELETE_FILE_EVENT;}
2454
2695
  int get_data_size() { return DELETE_FILE_HEADER_LEN ;}
2455
2696
  bool is_valid() const { return file_id != 0; }
 
2697
#ifndef DRIZZLE_CLIENT
2456
2698
  bool write(IO_CACHE* file);
2457
2699
  const char* get_db() { return db; }
 
2700
#endif
2458
2701
 
2459
2702
private:
 
2703
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2460
2704
  virtual int do_apply_event(Relay_log_info const *rli);
 
2705
#endif
2461
2706
};
2462
2707
 
2463
2708
 
2470
2715
class Execute_load_log_event: public Log_event
2471
2716
{
2472
2717
public:
2473
 
  uint32_t file_id;
 
2718
  uint file_id;
2474
2719
  const char* db; /* see comment in Append_block_log_event */
2475
2720
 
2476
 
  Execute_load_log_event(Session* session, const char* db_arg, bool using_trans);
 
2721
#ifndef DRIZZLE_CLIENT
 
2722
  Execute_load_log_event(THD* thd, const char* db_arg, bool using_trans);
 
2723
#ifdef HAVE_REPLICATION
2477
2724
  void pack_info(Protocol* protocol);
 
2725
#endif /* HAVE_REPLICATION */
 
2726
#else
 
2727
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
 
2728
#endif
2478
2729
 
2479
 
  Execute_load_log_event(const char* buf, uint32_t event_len,
 
2730
  Execute_load_log_event(const char* buf, uint event_len,
2480
2731
                         const Format_description_log_event
2481
2732
                         *description_event);
2482
2733
  ~Execute_load_log_event() {}
2483
2734
  Log_event_type get_type_code() { return EXEC_LOAD_EVENT;}
2484
2735
  int get_data_size() { return  EXEC_LOAD_HEADER_LEN ;}
2485
2736
  bool is_valid() const { return file_id != 0; }
 
2737
#ifndef DRIZZLE_CLIENT
2486
2738
  bool write(IO_CACHE* file);
2487
2739
  const char* get_db() { return db; }
 
2740
#endif
2488
2741
 
2489
2742
private:
 
2743
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2490
2744
  virtual int do_apply_event(Relay_log_info const *rli);
 
2745
#endif
2491
2746
};
2492
2747
 
2493
2748
 
2503
2758
class Begin_load_query_log_event: public Append_block_log_event
2504
2759
{
2505
2760
public:
2506
 
  Begin_load_query_log_event(Session* session_arg, const char *db_arg,
2507
 
                             unsigned char* block_arg, uint32_t block_len_arg,
 
2761
#ifndef DRIZZLE_CLIENT
 
2762
  Begin_load_query_log_event(THD* thd_arg, const char *db_arg,
 
2763
                             uchar* block_arg, uint block_len_arg,
2508
2764
                             bool using_trans);
2509
 
  Begin_load_query_log_event(Session* session);
 
2765
#ifdef HAVE_REPLICATION
 
2766
  Begin_load_query_log_event(THD* thd);
2510
2767
  int get_create_or_append() const;
2511
 
  Begin_load_query_log_event(const char* buf, uint32_t event_len,
 
2768
#endif /* HAVE_REPLICATION */
 
2769
#endif
 
2770
  Begin_load_query_log_event(const char* buf, uint event_len,
2512
2771
                             const Format_description_log_event
2513
2772
                             *description_event);
2514
2773
  ~Begin_load_query_log_event() {}
2515
2774
  Log_event_type get_type_code() { return BEGIN_LOAD_QUERY_EVENT; }
2516
2775
private:
 
2776
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2517
2777
  virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
 
2778
#endif
2518
2779
};
2519
2780
 
2520
2781
 
2536
2797
class Execute_load_query_log_event: public Query_log_event
2537
2798
{
2538
2799
public:
2539
 
  uint32_t file_id;       // file_id of temporary file
2540
 
  uint32_t fn_pos_start;  // pointer to the part of the query that should
 
2800
  uint file_id;       // file_id of temporary file
 
2801
  uint fn_pos_start;  // pointer to the part of the query that should
2541
2802
                      // be substituted
2542
 
  uint32_t fn_pos_end;    // pointer to the end of this part of query
 
2803
  uint fn_pos_end;    // pointer to the end of this part of query
2543
2804
  /*
2544
2805
    We have to store type of duplicate handling explicitly, because
2545
2806
    for LOAD DATA it also depends on LOCAL option. And this part
2548
2809
  */
2549
2810
  enum_load_dup_handling dup_handling;
2550
2811
 
2551
 
  Execute_load_query_log_event(Session* session, const char* query_arg,
2552
 
                               ulong query_length, uint32_t fn_pos_start_arg,
2553
 
                               uint32_t fn_pos_end_arg,
 
2812
#ifndef DRIZZLE_CLIENT
 
2813
  Execute_load_query_log_event(THD* thd, const char* query_arg,
 
2814
                               ulong query_length, uint fn_pos_start_arg,
 
2815
                               uint fn_pos_end_arg,
2554
2816
                               enum_load_dup_handling dup_handling_arg,
2555
2817
                               bool using_trans, bool suppress_use,
2556
 
                               Session::killed_state
2557
 
                               killed_err_arg= Session::KILLED_NO_VALUE);
 
2818
                               THD::killed_state
 
2819
                               killed_err_arg= THD::KILLED_NO_VALUE);
 
2820
#ifdef HAVE_REPLICATION
2558
2821
  void pack_info(Protocol* protocol);
2559
 
  Execute_load_query_log_event(const char* buf, uint32_t event_len,
 
2822
#endif /* HAVE_REPLICATION */
 
2823
#else
 
2824
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
 
2825
  /* Prints the query as LOAD DATA LOCAL and with rewritten filename */
 
2826
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info,
 
2827
             const char *local_fname);
 
2828
#endif
 
2829
  Execute_load_query_log_event(const char* buf, uint event_len,
2560
2830
                               const Format_description_log_event
2561
2831
                               *description_event);
2562
2832
  ~Execute_load_query_log_event() {}
2565
2835
  bool is_valid() const { return Query_log_event::is_valid() && file_id != 0; }
2566
2836
 
2567
2837
  ulong get_post_header_size_for_derived();
 
2838
#ifndef DRIZZLE_CLIENT
2568
2839
  bool write_post_header_for_derived(IO_CACHE* file);
 
2840
#endif
2569
2841
 
2570
2842
private:
 
2843
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2571
2844
  virtual int do_apply_event(Relay_log_info const *rli);
2572
 
};
2573
 
 
2574
 
 
2575
 
char *str_to_hex(char *to, const char *from, uint32_t len);
 
2845
#endif
 
2846
};
 
2847
 
 
2848
 
 
2849
#ifdef DRIZZLE_CLIENT
 
2850
/**
 
2851
  @class Unknown_log_event
 
2852
 
 
2853
  @section Unknown_log_event_binary_format Binary Format
 
2854
*/
 
2855
class Unknown_log_event: public Log_event
 
2856
{
 
2857
public:
 
2858
  /*
 
2859
    Even if this is an unknown event, we still pass description_event to
 
2860
    Log_event's ctor, this way we can extract maximum information from the
 
2861
    event's header (the unique ID for example).
 
2862
  */
 
2863
  Unknown_log_event(const char* buf,
 
2864
                    const Format_description_log_event *description_event):
 
2865
    Log_event(buf, description_event)
 
2866
  {}
 
2867
  ~Unknown_log_event() {}
 
2868
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
 
2869
  Log_event_type get_type_code() { return UNKNOWN_EVENT;}
 
2870
  bool is_valid() const { return 1; }
 
2871
};
 
2872
#endif
 
2873
char *str_to_hex(char *to, const char *from, uint len);
2576
2874
 
2577
2875
/**
2578
2876
  @class Table_map_log_event
2865
3163
  void clear_flags(flag_set flag) { m_flags &= ~flag; }
2866
3164
  flag_set get_flags(flag_set flag) const { return m_flags & flag; }
2867
3165
 
2868
 
  Table_map_log_event(Session *session, Table *tbl, ulong tid, 
 
3166
#ifndef DRIZZLE_CLIENT
 
3167
  Table_map_log_event(THD *thd, Table *tbl, ulong tid, 
2869
3168
                      bool is_transactional, uint16_t flags);
2870
 
  Table_map_log_event(const char *buf, uint32_t event_len, 
 
3169
#endif
 
3170
#ifdef HAVE_REPLICATION
 
3171
  Table_map_log_event(const char *buf, uint event_len, 
2871
3172
                      const Format_description_log_event *description_event);
 
3173
#endif
2872
3174
 
2873
3175
  ~Table_map_log_event();
2874
3176
 
2876
3178
  virtual bool is_valid() const { return m_memory != NULL; /* we check malloc */ }
2877
3179
 
2878
3180
  virtual int get_data_size() { return m_data_size; } 
 
3181
#ifndef DRIZZLE_CLIENT
2879
3182
  virtual int save_field_metadata();
2880
3183
  virtual bool write_data_header(IO_CACHE *file);
2881
3184
  virtual bool write_data_body(IO_CACHE *file);
2882
3185
  virtual const char *get_db() { return m_dbnam; }
 
3186
#endif
 
3187
 
 
3188
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2883
3189
  virtual void pack_info(Protocol *protocol);
 
3190
#endif
 
3191
 
 
3192
#ifdef DRIZZLE_CLIENT
 
3193
  virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
 
3194
#endif
 
3195
 
2884
3196
 
2885
3197
private:
 
3198
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2886
3199
  virtual int do_apply_event(Relay_log_info const *rli);
2887
3200
  virtual int do_update_pos(Relay_log_info *rli);
2888
3201
  virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
 
3202
#endif
2889
3203
 
 
3204
#ifndef DRIZZLE_CLIENT
2890
3205
  Table         *m_table;
 
3206
#endif
2891
3207
  char const    *m_dbnam;
2892
3208
  size_t         m_dblen;
2893
3209
  char const    *m_tblnam;
2894
3210
  size_t         m_tbllen;
2895
3211
  ulong          m_colcnt;
2896
 
  unsigned char         *m_coltype;
 
3212
  uchar         *m_coltype;
2897
3213
 
2898
 
  unsigned char         *m_memory;
 
3214
  uchar         *m_memory;
2899
3215
  ulong          m_table_id;
2900
3216
  flag_set       m_flags;
2901
3217
 
2902
3218
  size_t         m_data_size;
2903
3219
 
2904
 
  unsigned char          *m_field_metadata;        // buffer for field metadata
 
3220
  uchar          *m_field_metadata;        // buffer for field metadata
2905
3221
  /*
2906
3222
    The size of field metadata buffer set by calling save_field_metadata()
2907
3223
  */
2908
3224
  ulong          m_field_metadata_size;   
2909
 
  unsigned char         *m_null_bits;
2910
 
  unsigned char         *m_meta_memory;
 
3225
  uchar         *m_null_bits;
 
3226
  uchar         *m_meta_memory;
2911
3227
};
2912
3228
 
2913
3229
 
2954
3270
    /* Last event of a statement */
2955
3271
    STMT_END_F = (1U << 0),
2956
3272
 
2957
 
    /* Value of the OPTION_NO_FOREIGN_KEY_CHECKS flag in session->options */
 
3273
    /* Value of the OPTION_NO_FOREIGN_KEY_CHECKS flag in thd->options */
2958
3274
    NO_FOREIGN_KEY_CHECKS_F = (1U << 1),
2959
3275
 
2960
 
    /* Value of the OPTION_RELAXED_UNIQUE_CHECKS flag in session->options */
 
3276
    /* Value of the OPTION_RELAXED_UNIQUE_CHECKS flag in thd->options */
2961
3277
    RELAXED_UNIQUE_CHECKS_F = (1U << 2),
2962
3278
 
2963
3279
    /** 
2981
3297
  void clear_flags(flag_set flags_arg) { m_flags &= ~flags_arg; }
2982
3298
  flag_set get_flags(flag_set flags_arg) const { return m_flags & flags_arg; }
2983
3299
 
 
3300
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2984
3301
  virtual void pack_info(Protocol *protocol);
2985
 
 
2986
 
  int add_row_data(unsigned char *data, size_t length)
 
3302
#endif
 
3303
 
 
3304
#ifdef DRIZZLE_CLIENT
 
3305
  /* not for direct call, each derived has its own ::print() */
 
3306
  virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info)= 0;
 
3307
#endif
 
3308
 
 
3309
#ifndef DRIZZLE_CLIENT
 
3310
  int add_row_data(uchar *data, size_t length)
2987
3311
  {
2988
3312
    return do_add_row_data(data,length); 
2989
3313
  }
 
3314
#endif
2990
3315
 
2991
3316
  /* Member functions to implement superclass interface */
2992
3317
  virtual int get_data_size();
2995
3320
  size_t get_width() const          { return m_width; }
2996
3321
  ulong get_table_id() const        { return m_table_id; }
2997
3322
 
 
3323
#ifndef DRIZZLE_CLIENT
2998
3324
  virtual bool write_data_header(IO_CACHE *file);
2999
3325
  virtual bool write_data_body(IO_CACHE *file);
3000
3326
  virtual const char *get_db() { return m_table->s->db.str; }
 
3327
#endif
3001
3328
  /*
3002
3329
    Check that malloc() succeeded in allocating memory for the rows
3003
3330
    buffer and the COLS vector. Checking that an Update_rows_log_event
3009
3336
    return m_rows_buf && m_cols.bitmap;
3010
3337
  }
3011
3338
 
3012
 
  uint32_t     m_row_count;         /* The number of rows added to the event */
 
3339
  uint     m_row_count;         /* The number of rows added to the event */
3013
3340
 
3014
3341
protected:
3015
3342
  /* 
3016
3343
     The constructors are protected since you're supposed to inherit
3017
3344
     this class, not create instances of this class.
3018
3345
  */
3019
 
  Rows_log_event(Session*, Table*, ulong table_id, 
 
3346
#ifndef DRIZZLE_CLIENT
 
3347
  Rows_log_event(THD*, Table*, ulong table_id, 
3020
3348
                 MY_BITMAP const *cols, bool is_transactional);
3021
 
  Rows_log_event(const char *row_data, uint32_t event_len, 
 
3349
#endif
 
3350
  Rows_log_event(const char *row_data, uint event_len, 
3022
3351
                 Log_event_type event_type,
3023
3352
                 const Format_description_log_event *description_event);
3024
3353
 
3025
 
  virtual int do_add_row_data(unsigned char *data, size_t length);
3026
 
 
 
3354
#ifdef DRIZZLE_CLIENT
 
3355
  void print_helper(FILE *, PRINT_EVENT_INFO *, char const *const name);
 
3356
#endif
 
3357
 
 
3358
#ifndef DRIZZLE_CLIENT
 
3359
  virtual int do_add_row_data(uchar *data, size_t length);
 
3360
#endif
 
3361
 
 
3362
#ifndef DRIZZLE_CLIENT
3027
3363
  Table *m_table;               /* The table the rows belong to */
 
3364
#endif
3028
3365
  ulong       m_table_id;       /* Table ID */
3029
3366
  MY_BITMAP   m_cols;           /* Bitmap denoting columns available */
3030
3367
  ulong       m_width;          /* The width of the columns bitmap */
3043
3380
  uint32_t    m_bitbuf[128/(sizeof(uint32_t)*8)];
3044
3381
  uint32_t    m_bitbuf_ai[128/(sizeof(uint32_t)*8)];
3045
3382
 
3046
 
  unsigned char    *m_rows_buf;         /* The rows in packed format */
3047
 
  unsigned char    *m_rows_cur;         /* One-after the end of the data */
3048
 
  unsigned char    *m_rows_end;         /* One-after the end of the allocated space */
 
3383
  uchar    *m_rows_buf;         /* The rows in packed format */
 
3384
  uchar    *m_rows_cur;         /* One-after the end of the data */
 
3385
  uchar    *m_rows_end;         /* One-after the end of the allocated space */
3049
3386
 
3050
3387
  flag_set m_flags;             /* Flags for row-level events */
3051
3388
 
3052
3389
  /* helper functions */
3053
3390
 
3054
 
  const unsigned char *m_curr_row;     /* Start of the row being processed */
3055
 
  const unsigned char *m_curr_row_end; /* One-after the end of the current row */
3056
 
  unsigned char    *m_key;      /* Buffer to keep key value during searches */
 
3391
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
 
3392
  const uchar *m_curr_row;     /* Start of the row being processed */
 
3393
  const uchar *m_curr_row_end; /* One-after the end of the current row */
 
3394
  uchar    *m_key;      /* Buffer to keep key value during searches */
3057
3395
 
3058
3396
  int find_row(const Relay_log_info *const);
3059
3397
  int write_row(const Relay_log_info *const, const bool);
3060
3398
 
3061
3399
  // Unpack the current row into m_table->record[0]
3062
3400
  int unpack_current_row(const Relay_log_info *const rli,
3063
 
                         MY_BITMAP const *cols);
 
3401
                         MY_BITMAP const *cols)
 
3402
  { 
 
3403
    assert(m_table);
 
3404
    ASSERT_OR_RETURN_ERROR(m_curr_row < m_rows_end, HA_ERR_CORRUPT_EVENT);
 
3405
    int const result= ::unpack_row(rli, m_table, m_width, m_curr_row, cols,
 
3406
                                   &m_curr_row_end, &m_master_reclength);
 
3407
    if (m_curr_row_end > m_rows_end)
 
3408
      my_error(ER_SLAVE_CORRUPT_EVENT, MYF(0));
 
3409
    ASSERT_OR_RETURN_ERROR(m_curr_row_end <= m_rows_end, HA_ERR_CORRUPT_EVENT);
 
3410
    return result;
 
3411
  }
 
3412
#endif
3064
3413
 
3065
3414
private:
3066
3415
 
 
3416
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3067
3417
  virtual int do_apply_event(Relay_log_info const *rli);
3068
3418
  virtual int do_update_pos(Relay_log_info *rli);
3069
3419
  virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
3118
3468
      
3119
3469
  */
3120
3470
  virtual int do_exec_row(const Relay_log_info *const rli) = 0;
 
3471
#endif /* !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION) */
3121
3472
 
3122
3473
  friend class Old_rows_log_event;
3123
3474
};
3136
3487
public:
3137
3488
  enum 
3138
3489
  {
3139
 
    /* Support interface to Session::binlog_prepare_pending_rows_event */
 
3490
    /* Support interface to THD::binlog_prepare_pending_rows_event */
3140
3491
    TYPE_CODE = WRITE_ROWS_EVENT
3141
3492
  };
3142
3493
 
3143
 
  Write_rows_log_event(Session*, Table*, ulong table_id, 
 
3494
#if !defined(DRIZZLE_CLIENT)
 
3495
  Write_rows_log_event(THD*, Table*, ulong table_id, 
3144
3496
                       bool is_transactional);
3145
 
  Write_rows_log_event(const char *buf, uint32_t event_len, 
 
3497
#endif
 
3498
#ifdef HAVE_REPLICATION
 
3499
  Write_rows_log_event(const char *buf, uint event_len, 
3146
3500
                       const Format_description_log_event *description_event);
3147
 
  static bool binlog_row_logging_function(Session *session, Table *table,
 
3501
#endif
 
3502
#if !defined(DRIZZLE_CLIENT) 
 
3503
  static bool binlog_row_logging_function(THD *thd, Table *table,
3148
3504
                                          bool is_transactional,
3149
 
                                          const unsigned char *,
3150
 
                                          const unsigned char *after_record)
 
3505
                                          const uchar *before_record
 
3506
                                          __attribute__((unused)),
 
3507
                                          const uchar *after_record)
3151
3508
  {
3152
 
    return session->binlog_write_row(table, is_transactional, after_record);
 
3509
    return thd->binlog_write_row(table, is_transactional, after_record);
3153
3510
  }
 
3511
#endif
3154
3512
 
3155
3513
private:
3156
3514
  virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; }
3157
3515
 
 
3516
#ifdef DRIZZLE_CLIENT
 
3517
  void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
 
3518
#endif
 
3519
 
 
3520
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3158
3521
  virtual int do_before_row_operations(const Slave_reporting_capability *const);
3159
3522
  virtual int do_after_row_operations(const Slave_reporting_capability *const,int);
3160
3523
  virtual int do_exec_row(const Relay_log_info *const);
 
3524
#endif
3161
3525
};
3162
3526
 
3163
3527
 
3178
3542
public:
3179
3543
  enum 
3180
3544
  {
3181
 
    /* Support interface to Session::binlog_prepare_pending_rows_event */
 
3545
    /* Support interface to THD::binlog_prepare_pending_rows_event */
3182
3546
    TYPE_CODE = UPDATE_ROWS_EVENT
3183
3547
  };
3184
3548
 
3185
 
  Update_rows_log_event(Session*, Table*, ulong table_id,
 
3549
#ifndef DRIZZLE_CLIENT
 
3550
  Update_rows_log_event(THD*, Table*, ulong table_id,
3186
3551
                        bool is_transactional);
3187
3552
 
3188
3553
  void init(MY_BITMAP const *cols);
 
3554
#endif
3189
3555
 
3190
3556
  virtual ~Update_rows_log_event();
3191
3557
 
3192
 
  Update_rows_log_event(const char *buf, uint32_t event_len, 
 
3558
#ifdef HAVE_REPLICATION
 
3559
  Update_rows_log_event(const char *buf, uint event_len, 
3193
3560
                        const Format_description_log_event *description_event);
 
3561
#endif
3194
3562
 
3195
 
  static bool binlog_row_logging_function(Session *session, Table *table,
 
3563
#if !defined(DRIZZLE_CLIENT) 
 
3564
  static bool binlog_row_logging_function(THD *thd, Table *table,
3196
3565
                                          bool is_transactional,
3197
 
                                          const unsigned char *before_record,
3198
 
                                          const unsigned char *after_record)
 
3566
                                          const uchar *before_record,
 
3567
                                          const uchar *after_record)
3199
3568
  {
3200
 
    return session->binlog_update_row(table, is_transactional,
 
3569
    return thd->binlog_update_row(table, is_transactional,
3201
3570
                                  before_record, after_record);
3202
3571
  }
 
3572
#endif
3203
3573
 
3204
3574
  virtual bool is_valid() const
3205
3575
  {
3209
3579
protected:
3210
3580
  virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; }
3211
3581
 
 
3582
#ifdef DRIZZLE_CLIENT
 
3583
  void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
 
3584
#endif
 
3585
 
 
3586
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3212
3587
  virtual int do_before_row_operations(const Slave_reporting_capability *const);
3213
3588
  virtual int do_after_row_operations(const Slave_reporting_capability *const,int);
3214
3589
  virtual int do_exec_row(const Relay_log_info *const);
 
3590
#endif /* !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION) */
3215
3591
};
3216
3592
 
3217
3593
/**
3239
3615
public:
3240
3616
  enum 
3241
3617
  {
3242
 
    /* Support interface to Session::binlog_prepare_pending_rows_event */
 
3618
    /* Support interface to THD::binlog_prepare_pending_rows_event */
3243
3619
    TYPE_CODE = DELETE_ROWS_EVENT
3244
3620
  };
3245
3621
 
3246
 
  Delete_rows_log_event(Session*, Table*, ulong, 
 
3622
#ifndef DRIZZLE_CLIENT
 
3623
  Delete_rows_log_event(THD*, Table*, ulong, 
3247
3624
                        bool is_transactional);
3248
 
  Delete_rows_log_event(const char *buf, uint32_t event_len, 
 
3625
#endif
 
3626
#ifdef HAVE_REPLICATION
 
3627
  Delete_rows_log_event(const char *buf, uint event_len, 
3249
3628
                        const Format_description_log_event *description_event);
3250
 
  static bool binlog_row_logging_function(Session *session, Table *table,
 
3629
#endif
 
3630
#if !defined(DRIZZLE_CLIENT) 
 
3631
  static bool binlog_row_logging_function(THD *thd, Table *table,
3251
3632
                                          bool is_transactional,
3252
 
                                          const unsigned char *before_record,
3253
 
                                          const unsigned char *)
 
3633
                                          const uchar *before_record,
 
3634
                                          const uchar *after_record
 
3635
                                          __attribute__((unused)))
3254
3636
  {
3255
 
    return session->binlog_delete_row(table, is_transactional, before_record);
 
3637
    return thd->binlog_delete_row(table, is_transactional, before_record);
3256
3638
  }
 
3639
#endif
3257
3640
  
3258
3641
protected:
3259
3642
  virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; }
3260
3643
 
 
3644
#ifdef DRIZZLE_CLIENT
 
3645
  void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
 
3646
#endif
 
3647
 
 
3648
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3261
3649
  virtual int do_before_row_operations(const Slave_reporting_capability *const);
3262
3650
  virtual int do_after_row_operations(const Slave_reporting_capability *const,int);
3263
3651
  virtual int do_exec_row(const Relay_log_info *const);
 
3652
#endif
3264
3653
};
3265
3654
 
3266
3655
 
3302
3691
*/
3303
3692
class Incident_log_event : public Log_event {
3304
3693
public:
3305
 
  Incident_log_event(Session *session_arg, Incident incident)
3306
 
    : Log_event(session_arg, 0, false), m_incident(incident)
 
3694
#ifndef DRIZZLE_CLIENT
 
3695
  Incident_log_event(THD *thd_arg, Incident incident)
 
3696
    : Log_event(thd_arg, 0, false), m_incident(incident)
3307
3697
  {
3308
3698
    m_message.str= NULL;                    /* Just as a precaution */
3309
3699
    m_message.length= 0;
3310
3700
    return;
3311
3701
  }
3312
3702
 
3313
 
  Incident_log_event(Session *session_arg, Incident incident, LEX_STRING const msg)
3314
 
    : Log_event(session_arg, 0, false), m_incident(incident)
 
3703
  Incident_log_event(THD *thd_arg, Incident incident, LEX_STRING const msg)
 
3704
    : Log_event(thd_arg, 0, false), m_incident(incident)
3315
3705
  {
3316
3706
    m_message= msg;
3317
3707
    return;
3318
3708
  }
 
3709
#endif
3319
3710
 
 
3711
#ifndef DRIZZLE_CLIENT
3320
3712
  void pack_info(Protocol*);
 
3713
#endif
3321
3714
 
3322
 
  Incident_log_event(const char *buf, uint32_t event_len,
 
3715
  Incident_log_event(const char *buf, uint event_len,
3323
3716
                     const Format_description_log_event *descr_event);
3324
3717
 
3325
3718
  virtual ~Incident_log_event();
3326
3719
 
 
3720
#ifdef DRIZZLE_CLIENT
 
3721
  virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
 
3722
#endif
 
3723
 
 
3724
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3327
3725
  virtual int do_apply_event(Relay_log_info const *rli);
 
3726
#endif
3328
3727
 
3329
3728
  virtual bool write_data_header(IO_CACHE *file);
3330
3729
  virtual bool write_data_body(IO_CACHE *file);
3354
3753
    reinit_io_cache(cache, WRITE_CACHE, 0, false, true);
3355
3754
}
3356
3755
 
 
3756
#ifndef DRIZZLE_CLIENT
3357
3757
/*****************************************************************************
3358
3758
 
3359
3759
  Heartbeat Log Event class
3372
3772
class Heartbeat_log_event: public Log_event
3373
3773
{
3374
3774
public:
3375
 
  Heartbeat_log_event(const char* buf, uint32_t event_len,
 
3775
  Heartbeat_log_event(const char* buf, uint event_len,
3376
3776
                      const Format_description_log_event* description_event);
3377
3777
  Log_event_type get_type_code() { return HEARTBEAT_LOG_EVENT; }
3378
3778
  bool is_valid() const
3381
3781
              log_pos >= BIN_LOG_HEADER_SIZE);
3382
3782
    }
3383
3783
  const char * get_log_ident() { return log_ident; }
3384
 
  uint32_t get_ident_len() { return ident_len; }
 
3784
  uint get_ident_len() { return ident_len; }
3385
3785
  
3386
3786
private:
3387
3787
  const char* log_ident;
3388
 
  uint32_t ident_len;
 
3788
  uint ident_len;
3389
3789
};
 
3790
#endif
3390
3791
 
3391
3792
/**
3392
3793
  @} (end of group Replication)
3393
3794
*/
3394
3795
 
3395
 
#endif /* DRIZZLED_LOG_EVENT_H */
 
3796
#endif /* _log_event_h */