MySQL  8.0.18
Source Code Documentation
pfs_example_machines_by_emp_by_mtype.h
Go to the documentation of this file.
1 /* Copyright (c) 2017, 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 
23 #ifndef PLUGIN_PFS_TABLE_MACHINES_BY_EMP_BY_MTYPE_H_
24 #define PLUGIN_PFS_TABLE_MACHINES_BY_EMP_BY_MTYPE_H_
25 
28 #include <mysql/plugin.h>
29 
32 
33 /* Service handle */
34 extern SERVICE_TYPE(pfs_plugin_table) * table_svc;
35 
36 /* Global share pointer for table */
38 
39 /* A structure to denote a single row of the table. */
41  public:
42  char f_name[20];
43  unsigned int f_name_length;
44  char l_name[20];
45  unsigned int l_name_length;
48 
49  /* If there is a value in this row */
50  bool m_exist;
51 };
52 
53 /* A class to define position of cursor in table. */
55  /** Outer index for employee. */
56  unsigned int m_index_1;
57  /** Current index within index_1, for machine type. */
58  unsigned int m_index_2;
59 
60  /**
61  Constructor.
62  @param index_1 the first index initial value.
63  @param index_2 the second index initial value.
64  */
65  POS_m_by_emp_by_mtype(uint index_1, uint index_2)
66  : m_index_1(index_1), m_index_2(index_2) {}
67 
69  /**
70  Set this index at a given position.
71  */
72  void set_at(uint index_1, uint index_2) {
73  m_index_1 = index_1;
74  m_index_2 = index_2;
75  }
76 
77  /**
78  Set this index at a given position.
79  @param other a position
80  */
81  void set_at(const POS_m_by_emp_by_mtype *other) {
82  m_index_1 = other->m_index_1;
83  m_index_2 = other->m_index_2;
84  }
85 
86  void reset() {
87  m_index_1 = 0;
88  m_index_2 = 0;
89  }
90 
91  /**
92  Set this index after a given position.
93  @param other a position
94  */
95  void set_after(const POS_m_by_emp_by_mtype *other) {
96  m_index_1 = other->m_index_1;
97  m_index_2 = other->m_index_2 + 1;
98  }
99 
101  if (m_index_1 < EMPLOYEEE_NAME_MAX_ROWS) return true;
102  return false;
103  }
104 
106  if (m_index_2 < (unsigned int)TYPE_END) return true;
107  return false;
108  }
109 
111 
112  void next_employee() {
113  m_index_1++;
114  m_index_2 = 0;
115  }
116 };
117 
118 /* A structure to define a handle for table in plugin/component code. */
119 typedef struct {
120  /* Current position instance */
122  /* Next position instance */
124 
125  /* Current row for the table */
128 
135  bool sorted, PSI_index_handle **index);
137  PSI_key_reader *reader, unsigned int idx,
138  int find_flag);
142  PSI_field *field, uint index);
145  PSI_field *field, unsigned int index);
148  PSI_field *field, unsigned int index);
151 unsigned long long m_by_emp_by_mtype_get_row_count(void);
153 
154 #endif /* PLUGIN_PFS_TABLE_MACHINES_BY_EMP_BY_MTYPE_H_ */
POS_m_by_emp_by_mtype(uint index_1, uint index_2)
Constructor.
Definition: pfs_example_machines_by_emp_by_mtype.h:65
A share to be initialized by plugin/component code and to be provided to add_table() service method o...
Definition: pfs_plugin_table_service.h:443
struct PSI_table_handle PSI_table_handle
This is an opaque structure to denote table handle in plugin/component code.
Definition: pfs_plugin_table_service.h:96
int m_by_emp_by_mtype_read_column_value(PSI_table_handle *handle, PSI_field *field, uint index)
Definition: pfs_example_machines_by_emp_by_mtype.cc:169
struct PSI_index_handle PSI_index_handle
This is an opaque structure to denote Index Handle in plugin/component code.
Definition: pfs_plugin_table_service.h:109
void next_employee()
Definition: pfs_example_machines_by_emp_by_mtype.h:112
int m_by_emp_by_mtype_update_column_value(PSI_table_handle *handle, PSI_field *field, unsigned int index)
void set_at(const POS_m_by_emp_by_mtype *other)
Set this index at a given position.
Definition: pfs_example_machines_by_emp_by_mtype.h:81
char l_name[20]
Definition: pfs_example_machines_by_emp_by_mtype.h:44
PSI_enum machine_type
Definition: pfs_example_machines_by_emp_by_mtype.h:46
void * handle
Definition: engine_loader.c:19
int m_by_emp_by_mtype_rnd_init(PSI_table_handle *h, bool scan)
Definition: pfs_example_machines_by_emp_by_mtype.cc:117
M_by_emp_by_mtype_record current_row
Definition: pfs_example_machines_by_emp_by_mtype.h:126
unsigned int m_index_2
Current index within index_1, for machine type.
Definition: pfs_example_machines_by_emp_by_mtype.h:58
void set_at(uint index_1, uint index_2)
Set this index at a given position.
Definition: pfs_example_machines_by_emp_by_mtype.h:72
bool has_more_employee()
Definition: pfs_example_machines_by_emp_by_mtype.h:100
Definition: pfs_example_machines_by_emp_by_mtype.h:40
Definition: pfs_example_machine.h:43
#define SERVICE_TYPE(name)
struct PSI_pos PSI_pos
This is an opaque structure to denote cursor position in plugin/component code.
Definition: pfs_plugin_table_service.h:101
int m_by_emp_by_mtype_index_read(PSI_index_handle *index, PSI_key_reader *reader, unsigned int idx, int find_flag)
Definition: pfs_example_machines_by_emp_by_mtype.cc:145
int m_by_emp_by_mtype_index_init(PSI_table_handle *handle, uint idx, bool sorted, PSI_index_handle **index)
Definition: pfs_example_machines_by_emp_by_mtype.cc:136
unsigned int f_name_length
Definition: pfs_example_machines_by_emp_by_mtype.h:43
PSI_table_handle * m_by_emp_by_mtype_open_table(PSI_pos **pos)
Instantiate Table_Handle at plugin code when corresponding table in performance schema is opened...
Definition: pfs_example_machines_by_emp_by_mtype.cc:31
int m_by_emp_by_mtype_rnd_next(PSI_table_handle *handle)
Definition: pfs_example_machines_by_emp_by_mtype.cc:74
int m_by_emp_by_mtype_write_column_value(PSI_table_handle *handle, PSI_field *field, unsigned int index)
int m_by_emp_by_mtype_write_row_values(PSI_table_handle *handle)
char * index(const char *, int c)
Definition: mysql.cc:2862
int m_by_emp_by_mtype_rnd_pos(PSI_table_handle *handle)
Definition: pfs_example_machines_by_emp_by_mtype.cc:123
char * pos
Definition: do_ctype.cc:76
unsigned int l_name_length
Definition: pfs_example_machines_by_emp_by_mtype.h:45
void m_by_emp_by_mtype_reset_position(PSI_table_handle *handle)
Definition: pfs_example_machines_by_emp_by_mtype.cc:161
int m_by_emp_by_mtype_update_row_values(PSI_table_handle *handle)
POS_m_by_emp_by_mtype m_pos
Definition: pfs_example_machines_by_emp_by_mtype.h:121
void reset()
Definition: pfs_example_machines_by_emp_by_mtype.h:86
#define PSI_enum
Definition: pfs_plugin_table_service.h:152
const mysql_service_pfs_plugin_table_t * table_svc
Definition: pfs_example_plugin_employee.cc:87
int m_by_emp_by_mtype_delete_all_rows(void)
void init_m_by_emp_by_mtype_share(PFS_engine_table_share_proxy *share)
Definition: pfs_example_machines_by_emp_by_mtype.cc:198
int m_by_emp_by_mtype_index_next(PSI_table_handle *handle)
Definition: pfs_example_machines_by_emp_by_mtype.cc:154
unsigned int uint
Definition: uca-dump.cc:29
void set_after(const POS_m_by_emp_by_mtype *other)
Set this index after a given position.
Definition: pfs_example_machines_by_emp_by_mtype.h:95
POS_m_by_emp_by_mtype m_next_pos
Definition: pfs_example_machines_by_emp_by_mtype.h:123
Definition: pfs_example_machines_by_emp_by_mtype.h:119
Definition: pfs_example_machines_by_emp_by_mtype.h:54
void next_machine_type()
Definition: pfs_example_machines_by_emp_by_mtype.h:110
PFS_engine_table_share_proxy m_by_emp_by_mtype_st_share
Definition: pfs_example_machines_by_emp_by_mtype.cc:25
unsigned long long m_by_emp_by_mtype_get_row_count(void)
Definition: pfs_example_machines_by_emp_by_mtype.cc:196
int m_by_emp_by_mtype_delete_row_values(PSI_table_handle *handle)
void m_by_emp_by_mtype_close_table(PSI_table_handle *handle)
Destroy the Table_Handle at plugin code when corresponding table in performance schema is closed...
Definition: pfs_example_machines_by_emp_by_mtype.cc:41
char f_name[20]
Definition: pfs_example_machines_by_emp_by_mtype.h:42
struct PSI_field PSI_field
This is an opaque structure to denote filed in plugin/component code.
Definition: pfs_plugin_table_service.h:92
PSI_int count
Definition: pfs_example_machines_by_emp_by_mtype.h:47
struct PSI_key_reader PSI_key_reader
This is an opaque structure to denote Key Reader in plugin/component code.
Definition: pfs_plugin_table_service.h:105
bool has_more_machine_type()
Definition: pfs_example_machines_by_emp_by_mtype.h:105
Specifies macros to define Service Implementations.
POS_m_by_emp_by_mtype()
Definition: pfs_example_machines_by_emp_by_mtype.h:68
#define EMPLOYEEE_NAME_MAX_ROWS
Definition: pfs_example_employee_name.h:37
unsigned int m_index_1
Outer index for employee.
Definition: pfs_example_machines_by_emp_by_mtype.h:56
bool m_exist
Definition: pfs_example_machines_by_emp_by_mtype.h:50
#define PSI_int
Definition: pfs_plugin_table_service.h:147