1 /* Copyright (c) 2010, 2019, 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 St, Fifth Floor, Boston, MA 02110-1301  USA */
22 #ifndef RPL_INFO_TABLE_ACCESS_H
23 #define RPL_INFO_TABLE_ACCESS_H
24 
25 #include <sys/types.h>
26 
27 #include "sql/rpl_table_access.h"  // System_table_access
28 
29 class Field;
30 class Open_tables_backup;
31 class Rpl_info_values;
32 class THD;
33 struct TABLE;
34 
35 enum enum_return_id { FOUND_ID = 1, NOT_FOUND_ID, ERROR_ID };
36 
37 class Rpl_info_table_access : public System_table_access {
38  public:
Rpl_info_table_access()39   Rpl_info_table_access() : thd_created(false) {}
~Rpl_info_table_access()40   virtual ~Rpl_info_table_access() {}
41 
42   /**
43     Prepares before opening table.
44     - set flags
45     - start lex and reset the part of THD responsible
46       for the state of command processing if needed.
47 
48     @param[in]  thd  Thread requesting to open the table
49   */
50   void before_open(THD *thd);
51   bool close_table(THD *thd, TABLE *table, Open_tables_backup *backup,
52                    bool error);
53   enum enum_return_id find_info(Rpl_info_values *field_values, TABLE *table);
54   enum enum_return_id scan_info(TABLE *table, uint instance);
55   bool count_info(TABLE *table, uint *counter);
56   bool load_info_values(uint max_num_field, Field **fields,
57                         Rpl_info_values *field_values);
58   bool store_info_values(uint max_num_field, Field **fields,
59                          Rpl_info_values *field_values);
60   THD *create_thd();
61   void drop_thd(THD *thd);
62 
63  private:
64   bool thd_created;
65 
66   Rpl_info_table_access &operator=(const Rpl_info_table_access &info);
67   Rpl_info_table_access(const Rpl_info_table_access &info);
68 };
69 #endif /* RPL_INFO_TABLE_ACCESS_H */
70