MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dynamic_ids.h
1 /* Copyright (c) 2010, 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
15 
16 #ifndef DYNAMIC_ID_H
17 
18 #define DYNAMIC_ID_H
19 
20 #include <my_sys.h>
21 #include <sql_string.h>
22 
24 {
25 public:
26  DYNAMIC_ARRAY dynamic_ids;
27 
28  Dynamic_ids(size_t param_size);
29  virtual ~Dynamic_ids();
30 
31  bool pack_dynamic_ids(String *buffer)
32  {
33  return(do_pack_dynamic_ids(buffer));
34  }
35 
36  bool unpack_dynamic_ids(char *param_dynamic_ids)
37  {
38  return(do_unpack_dynamic_ids(param_dynamic_ids));
39  }
40 
41  bool search_id(const void *id)
42  {
43  return (do_search_id(id));
44  }
45 
46 protected:
47  size_t size;
48 
49 private:
50  virtual bool do_pack_dynamic_ids(String *buffer)= 0;
51  virtual bool do_unpack_dynamic_ids(char *param_dynamic_ids)= 0;
52  virtual bool do_search_id(const void *id)= 0;
53 };
54 
55 class Server_ids : public Dynamic_ids
56 {
57 public:
58  Server_ids(size_t size): Dynamic_ids(size) { };
59  virtual ~Server_ids() { };
60 
61 private:
62  bool do_pack_dynamic_ids(String *buffer);
63  bool do_unpack_dynamic_ids(char *param_dynamic_ids);
64  bool do_search_id(const void *id);
65 };
66 
67 class Database_ids : public Dynamic_ids
68 {
69 public:
70  Database_ids(size_t size): Dynamic_ids(size) { };
71  virtual ~Database_ids() { };
72 
73 private:
74  bool do_pack_dynamic_ids(String *buffer);
75  bool do_unpack_dynamic_ids(char *param_dynamic_ids);
76  bool do_search_id(const void *id);
77 };
78 #endif