1/* Copyright (c) 2011, 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_HOSTS_H
17#define TABLE_HOSTS_H
18
19#include "pfs_column_types.h"
20#include "cursor_by_host.h"
21#include "table_helper.h"
22
23struct PFS_host;
24
25/**
26 \addtogroup Performance_schema_tables
27 @{
28*/
29
30/**
31 A row of PERFORMANCE_SCHEMA.HOSTS.
32*/
33struct row_hosts
34{
35 /** Column HOST. */
36 PFS_host_row m_host;
37 /** Columns CURRENT_CONNECTIONS, TOTAL_CONNECTIONS. */
38 PFS_connection_stat_row m_connection_stat;
39};
40
41/** Table PERFORMANCE_SCHEMA.THREADS. */
42class table_hosts : public cursor_by_host
43{
44public:
45 /** Table share */
46 static PFS_engine_table_share m_share;
47 /** Table builder */
48 static PFS_engine_table* create();
49 static int delete_all_rows();
50
51protected:
52 virtual int read_row_values(TABLE *table,
53 unsigned char *buf,
54 Field **fields,
55 bool read_all);
56
57
58protected:
59 table_hosts();
60
61public:
62 ~table_hosts()
63 {}
64
65private:
66 virtual void make_row(PFS_host *pfs);
67
68 /** Table share lock. */
69 static THR_LOCK m_table_lock;
70
71 /** Current row. */
72 row_hosts m_row;
73 /** True if the current row exists. */
74 bool m_row_exists;
75};
76
77/** @} */
78#endif
79