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