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_ACTORS_H
17#define TABLE_SETUP_ACTORS_H
18
19/**
20 @file storage/perfschema/table_setup_actors.h
21 Table SETUP_ACTORS (declarations).
22*/
23
24#include "pfs_engine_table.h"
25
26struct PFS_setup_actor;
27
28/**
29 @addtogroup Performance_schema_tables
30 @{
31*/
32
33/** A row of PERFORMANCE_SCHEMA.SETUP_ACTORS. */
34struct row_setup_actors
35{
36 /** Column HOST. */
37 char m_hostname[HOSTNAME_LENGTH];
38 /** Length in bytes of @c m_hostname. */
39 uint m_hostname_length;
40 /** Column USER. */
41 char m_username[USERNAME_LENGTH];
42 /** Length in bytes of @c m_username. */
43 uint m_username_length;
44 /** Column ROLE. */
45 char m_rolename[16];
46 /** Length in bytes of @c m_rolename. */
47 uint m_rolename_length;
48};
49
50/** Table PERFORMANCE_SCHEMA.SETUP_ACTORS. */
51class table_setup_actors : public PFS_engine_table
52{
53public:
54 /** Table share. */
55 static PFS_engine_table_share m_share;
56 /** Table builder. */
57 static PFS_engine_table* create();
58 static int write_row(TABLE *table, unsigned char *buf, Field **fields);
59 static int delete_all_rows();
60 static ha_rows get_row_count();
61
62 virtual int rnd_next();
63 virtual int rnd_pos(const void *pos);
64 virtual void reset_position(void);
65
66protected:
67 virtual int read_row_values(TABLE *table,
68 unsigned char *buf,
69 Field **fields,
70 bool read_all);
71
72 virtual int update_row_values(TABLE *table,
73 const unsigned char *old_buf,
74 const unsigned char *new_buf,
75 Field **fields);
76
77 virtual int delete_row_values(TABLE *table,
78 const unsigned char *buf,
79 Field **fields);
80
81 table_setup_actors();
82
83public:
84 ~table_setup_actors()
85 {}
86
87private:
88 void make_row(PFS_setup_actor *actor);
89
90 /** Table share lock. */
91 static THR_LOCK m_table_lock;
92
93 /** Current row. */
94 row_setup_actors m_row;
95 /** True if the current row exists. */
96 bool m_row_exists;
97 /** Current position. */
98 PFS_simple_index m_pos;
99 /** Next position. */
100 PFS_simple_index m_next_pos;
101};
102
103/** @} */
104#endif
105