1 | /* Copyright (c) 2012, 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 CURSOR_BY_THREAD_CONNECT_ATTR_H |
17 | #define CURSOR_BY_THREAD_CONNECT_ATTR_H |
18 | |
19 | #include "pfs_column_types.h" |
20 | #include "pfs_engine_table.h" |
21 | #include "pfs_instr.h" |
22 | |
23 | /** |
24 | \addtogroup Performance_schema_tables |
25 | @{ |
26 | */ |
27 | |
28 | struct pos_connect_attr_by_thread_by_attr |
29 | : public PFS_double_index |
30 | { |
31 | pos_connect_attr_by_thread_by_attr() |
32 | : PFS_double_index(0, 0) |
33 | {} |
34 | |
35 | inline bool has_more_thread(void) |
36 | { |
37 | return (m_index_1 < thread_max); |
38 | } |
39 | |
40 | inline void next_thread(void) |
41 | { |
42 | m_index_1++; |
43 | m_index_2= 0; |
44 | } |
45 | |
46 | inline void reset(void) |
47 | { |
48 | m_index_1= 0; |
49 | m_index_2= 0; |
50 | } |
51 | }; |
52 | |
53 | /** Cursor CURSOR_BY_THREAD_CONNECT_ATTR. */ |
54 | class cursor_by_thread_connect_attr : public PFS_engine_table |
55 | { |
56 | public: |
57 | virtual int rnd_next(); |
58 | virtual int rnd_pos(const void *pos); |
59 | virtual void reset_position(void); |
60 | |
61 | protected: |
62 | cursor_by_thread_connect_attr(const PFS_engine_table_share *share); |
63 | |
64 | public: |
65 | ~cursor_by_thread_connect_attr() |
66 | {} |
67 | |
68 | protected: |
69 | virtual void make_row(PFS_thread *thread, uint ordinal)= 0; |
70 | /** True if row exists */ |
71 | bool m_row_exists; |
72 | |
73 | private: |
74 | /** Current position. */ |
75 | pos_connect_attr_by_thread_by_attr m_pos; |
76 | /** Next position. */ |
77 | pos_connect_attr_by_thread_by_attr m_next_pos; |
78 | }; |
79 | |
80 | /** @} */ |
81 | #endif |
82 | |