| 1 | /* Copyright (c) 2008, 2010, 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_SETUP_OBJECTS_H |
| 17 | #define TABLE_SETUP_OBJECTS_H |
| 18 | |
| 19 | /** |
| 20 | @file storage/perfschema/table_setup_objects.h |
| 21 | Table SETUP_OBJECTS (declarations). |
| 22 | */ |
| 23 | |
| 24 | #include "pfs_engine_table.h" |
| 25 | #include "table_helper.h" |
| 26 | |
| 27 | struct PFS_setup_object; |
| 28 | |
| 29 | /** |
| 30 | @addtogroup Performance_schema_tables |
| 31 | @{ |
| 32 | */ |
| 33 | |
| 34 | /** A row of PERFORMANCE_SCHEMA.SETUP_OBJECTS. */ |
| 35 | struct row_setup_objects |
| 36 | { |
| 37 | /** Column OBJECT_TYPE. */ |
| 38 | enum_object_type m_object_type; |
| 39 | /** Column SCHEMA_NAME. */ |
| 40 | char m_schema_name[NAME_LEN]; |
| 41 | /** Length in bytes of @c m_schema_name. */ |
| 42 | uint m_schema_name_length; |
| 43 | /** Column OBJECT_NAME. */ |
| 44 | char m_object_name[NAME_LEN]; |
| 45 | /** Length in bytes of @c m_object_name. */ |
| 46 | uint m_object_name_length; |
| 47 | /** Column ENABLED. */ |
| 48 | bool *m_enabled_ptr; |
| 49 | /** Column TIMED. */ |
| 50 | bool *m_timed_ptr; |
| 51 | }; |
| 52 | |
| 53 | /** Table PERFORMANCE_SCHEMA.SETUP_OBJECTS. */ |
| 54 | class table_setup_objects : public PFS_engine_table |
| 55 | { |
| 56 | public: |
| 57 | /** Table share. */ |
| 58 | static PFS_engine_table_share m_share; |
| 59 | /** Table builder. */ |
| 60 | static PFS_engine_table* create(); |
| 61 | static int write_row(TABLE *table, unsigned char *buf, Field **fields); |
| 62 | static int delete_all_rows(); |
| 63 | static ha_rows get_row_count(); |
| 64 | |
| 65 | virtual int rnd_next(); |
| 66 | virtual int rnd_pos(const void *pos); |
| 67 | virtual void reset_position(void); |
| 68 | |
| 69 | protected: |
| 70 | virtual int read_row_values(TABLE *table, |
| 71 | unsigned char *buf, |
| 72 | Field **fields, |
| 73 | bool read_all); |
| 74 | |
| 75 | virtual int update_row_values(TABLE *table, |
| 76 | const unsigned char *old_buf, |
| 77 | const unsigned char *new_buf, |
| 78 | Field **fields); |
| 79 | |
| 80 | virtual int delete_row_values(TABLE *table, |
| 81 | const unsigned char *buf, |
| 82 | Field **fields); |
| 83 | |
| 84 | table_setup_objects(); |
| 85 | |
| 86 | public: |
| 87 | ~table_setup_objects() |
| 88 | {} |
| 89 | |
| 90 | private: |
| 91 | void make_row(PFS_setup_object *pfs); |
| 92 | |
| 93 | /** Table share lock. */ |
| 94 | static THR_LOCK m_table_lock; |
| 95 | |
| 96 | /** Current row. */ |
| 97 | row_setup_objects m_row; |
| 98 | /** True is the current row exists. */ |
| 99 | bool m_row_exists; |
| 100 | /** Current position. */ |
| 101 | PFS_simple_index m_pos; |
| 102 | /** Next position. */ |
| 103 | PFS_simple_index m_next_pos; |
| 104 | }; |
| 105 | |
| 106 | /** @} */ |
| 107 | #endif |
| 108 | |