1 /* Copyright (c) 2011, 2021, Oracle and/or its affiliates.
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 Street, Fifth Floor, Boston, MA 02110-1301, USA */
22 
23 #ifndef CURSOR_BY_HOST_H
24 #define CURSOR_BY_HOST_H
25 
26 /**
27   @file storage/perfschema/cursor_by_host.h
28   Cursor CURSOR_BY_HOST (declarations).
29 */
30 
31 #include "pfs_engine_table.h"
32 #include "pfs_host.h"
33 #include "table_helper.h"
34 
35 /**
36   @addtogroup Performance_schema_tables
37   @{
38 */
39 
40 /** Cursor CURSOR_BY_HOST. */
41 class cursor_by_host : public PFS_engine_table
42 {
43 public:
44   static ha_rows get_row_count();
45 
46   virtual int rnd_next();
47   virtual int rnd_pos(const void *pos);
48   virtual void reset_position(void);
49 
50 protected:
51   cursor_by_host(const PFS_engine_table_share *share);
52 
53 public:
~cursor_by_host()54   ~cursor_by_host()
55   {}
56 
57 protected:
58   virtual void make_row(PFS_host *host)= 0;
59 
60 private:
61   /** Current position. */
62   PFS_simple_index m_pos;
63   /** Next position. */
64   PFS_simple_index m_next_pos;
65 };
66 
67 /** @} */
68 #endif
69