| 1 | /* Copyright (c) 2010, 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 |
| 14 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ |
| 15 | |
| 16 | #ifndef TABLE_ESMS_BY_DIGEST_H |
| 17 | #define TABLE_ESMS_BY_DIGEST_H |
| 18 | |
| 19 | /** |
| 20 | @file storage/perfschema/table_esms_by_digest.h |
| 21 | Table EVENTS_STATEMENTS_SUMMARY_BY_DIGEST (declarations). |
| 22 | */ |
| 23 | |
| 24 | #include "table_helper.h" |
| 25 | #include "pfs_digest.h" |
| 26 | |
| 27 | /** |
| 28 | @addtogroup Performance_schema_tables |
| 29 | @{ |
| 30 | */ |
| 31 | |
| 32 | /** |
| 33 | A row of table |
| 34 | PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_SUMMARY_BY_DIGEST. |
| 35 | */ |
| 36 | struct row_esms_by_digest |
| 37 | { |
| 38 | /** Columns DIGEST/DIGEST_TEXT. */ |
| 39 | PFS_digest_row m_digest; |
| 40 | |
| 41 | /** Columns COUNT_STAR, SUM/MIN/AVG/MAX TIMER_WAIT. */ |
| 42 | PFS_statement_stat_row m_stat; |
| 43 | |
| 44 | /** Column FIRST_SEEN. */ |
| 45 | ulonglong m_first_seen; |
| 46 | /** Column LAST_SEEN. */ |
| 47 | ulonglong m_last_seen; |
| 48 | }; |
| 49 | |
| 50 | /** Table PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_SUMMARY_BY_DIGEST. */ |
| 51 | class table_esms_by_digest : public PFS_engine_table |
| 52 | { |
| 53 | public: |
| 54 | /** Table share */ |
| 55 | static PFS_engine_table_share m_share; |
| 56 | static PFS_engine_table* create(); |
| 57 | static int delete_all_rows(); |
| 58 | |
| 59 | virtual int rnd_next(); |
| 60 | virtual int rnd_pos(const void *pos); |
| 61 | virtual void reset_position(void); |
| 62 | |
| 63 | protected: |
| 64 | virtual int read_row_values(TABLE *table, |
| 65 | unsigned char *buf, |
| 66 | Field **fields, |
| 67 | bool read_all); |
| 68 | |
| 69 | table_esms_by_digest(); |
| 70 | |
| 71 | public: |
| 72 | ~table_esms_by_digest() |
| 73 | {} |
| 74 | |
| 75 | protected: |
| 76 | void make_row(PFS_statements_digest_stat*); |
| 77 | |
| 78 | private: |
| 79 | /** Table share lock. */ |
| 80 | static THR_LOCK m_table_lock; |
| 81 | |
| 82 | /** Current row. */ |
| 83 | row_esms_by_digest m_row; |
| 84 | /** True is the current row exists. */ |
| 85 | bool m_row_exists; |
| 86 | /** Current position. */ |
| 87 | PFS_simple_index m_pos; |
| 88 | /** Next position. */ |
| 89 | PFS_simple_index m_next_pos; |
| 90 | }; |
| 91 | |
| 92 | /** @} */ |
| 93 | #endif |
| 94 | |