1 /* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
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, version 2.0,
5    as published by the Free Software Foundation.
6 
7    This program is also distributed with certain software (including
8    but not limited to OpenSSL) that is licensed under separate terms,
9    as designated in a particular file or component or in included license
10    documentation.  The authors of MySQL hereby grant you an additional
11    permission to link the program and your derivative works with the
12    separately licensed software that they have included with MySQL.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License, version 2.0, for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
22 
23 #ifndef RPL_INFO_DUMMY_H
24 #define RPL_INFO_DUMMY_H
25 
26 #include <my_global.h>
27 #include <sql_priv.h>
28 #include "rpl_info_handler.h"
29 
30 /**
31   Defines a dummy handler that should only be internally accessed.
32   This class is useful for debugging and performance tests.
33 
34   The flag abort indicates if the execution should abort if some
35   methods are called. See the code for further details.
36 */
37 class Rpl_info_dummy : public Rpl_info_handler
38 {
39 public:
40   Rpl_info_dummy(const int nparam);
~Rpl_info_dummy()41   virtual ~Rpl_info_dummy() { };
42 
43 private:
44   int do_init_info();
45   int do_init_info(uint instance);
46   enum_return_check do_check_info();
47   enum_return_check do_check_info(uint instance);
48   void do_end_info();
49   int do_flush_info(const bool force);
50   int do_remove_info();
51   int do_clean_info();
52   static int do_reset_info(const int nparam);
53 
54   int do_prepare_info_for_read();
55   int do_prepare_info_for_write();
56   bool do_set_info(const int pos, const char *value);
57   bool do_set_info(const int pos, const uchar *value,
58                    const size_t size);
59   bool do_set_info(const int pos, const int value);
60   bool do_set_info(const int pos, const ulong value);
61   bool do_set_info(const int pos, const float value);
62   bool do_set_info(const int pos, const Dynamic_ids *value);
63   bool do_get_info(const int pos, char *value, const size_t size,
64                    const char *default_value);
65   bool do_get_info(const int pos, uchar *value, const size_t size,
66                    const uchar *default_value);
67   bool do_get_info(const int pos, int *value,
68                    const int default_value);
69   bool do_get_info(const int pos, ulong *value,
70                    const ulong default_value);
71   bool do_get_info(const int pos, float *value,
72                    const float default_value);
73   bool do_get_info(const int pos, Dynamic_ids *value,
74                    const Dynamic_ids *default_value);
75   char* do_get_description_info();
76   bool do_is_transactional();
77   bool do_update_is_transactional();
78   uint do_get_rpl_info_type();
79 
80   static const bool abort= FALSE;
81 
82   Rpl_info_dummy& operator=(const Rpl_info_dummy& info);
83   Rpl_info_dummy(const Rpl_info_dummy& info);
84 };
85 #endif /* RPL_INFO_DUMMY_H */
86