1/* Copyright (c) 2008, 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 Foundation,
14 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
15
16#ifndef TABLE_SETUP_CONSUMERS_H
17#define TABLE_SETUP_CONSUMERS_H
18
19/**
20 @file storage/perfschema/table_setup_consumers.h
21 Table SETUP_CONSUMERS (declarations).
22*/
23
24#include "pfs_column_types.h"
25#include "pfs_engine_table.h"
26
27/**
28 @addtogroup Performance_schema_tables
29 @{
30*/
31
32/** A row of PERFORMANCE_SCHEMA.SETUP_CONSUMERS. */
33struct row_setup_consumers
34{
35 /** Column NAME. */
36 LEX_STRING m_name;
37 /** Column ENABLED. */
38 bool *m_enabled_ptr;
39 /** Hidden column, refresh. */
40 bool m_refresh;
41};
42
43/** Table PERFORMANCE_SCHEMA.SETUP_CONSUMERS. */
44class table_setup_consumers : public PFS_engine_table
45{
46public:
47 /** Table share. */
48 static PFS_engine_table_share m_share;
49 static PFS_engine_table* create();
50
51 virtual int rnd_next();
52 virtual int rnd_pos(const void *pos);
53 virtual void reset_position(void);
54
55protected:
56 virtual int read_row_values(TABLE *table,
57 unsigned char *buf,
58 Field **fields,
59 bool read_all);
60
61 virtual int update_row_values(TABLE *table,
62 const unsigned char *old_buf,
63 const unsigned char *new_buf,
64 Field **fields);
65
66 table_setup_consumers();
67
68public:
69 ~table_setup_consumers()
70 {}
71
72private:
73 /** Table share lock. */
74 static THR_LOCK m_table_lock;
75
76 /** Current row. */
77 row_setup_consumers *m_row;
78 /** Current position. */
79 PFS_simple_index m_pos;
80 /** Next position. */
81 PFS_simple_index m_next_pos;
82};
83
84/** @} */
85#endif
86