1 /* Copyright (c) 2012, 2013, 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, 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 Foundation, 21 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ 22 23 #ifndef TABLE_SESSION_CONNECT_H 24 #define TABLE_SESSION_CONNECT_H 25 26 #include "pfs_column_types.h" 27 #include "cursor_by_thread_connect_attr.h" 28 #include "table_helper.h" 29 30 #define MAX_ATTR_NAME_CHARS 32 31 #define MAX_ATTR_VALUE_CHARS 1024 32 #define MAX_UTF8_BYTES 6 33 34 /** symbolic names for field offsets, keep in sync with field_types */ 35 enum field_offsets { 36 FO_PROCESS_ID, 37 FO_ATTR_NAME, 38 FO_ATTR_VALUE, 39 FO_ORDINAL_POSITION 40 }; 41 42 /** 43 A row of PERFORMANCE_SCHEMA.SESSION_CONNECT_ATTRS and 44 PERFORMANCE_SCHEMA.SESSION_ACCOUNT_CONNECT_ATTRS. 45 */ 46 struct row_session_connect_attrs 47 { 48 /** Column PROCESS_ID. */ 49 ulong m_process_id; 50 /** Column ATTR_NAME. In UTF-8 */ 51 char m_attr_name[MAX_ATTR_NAME_CHARS * MAX_UTF8_BYTES]; 52 /** Length in bytes of @c m_attr_name. */ 53 uint m_attr_name_length; 54 /** Column ATTR_VALUE. In UTF-8 */ 55 char m_attr_value[MAX_ATTR_VALUE_CHARS * MAX_UTF8_BYTES]; 56 /** Length in bytes of @c m_attr_name. */ 57 uint m_attr_value_length; 58 /** Column ORDINAL_POSITION. */ 59 ulong m_ordinal_position; 60 }; 61 62 class table_session_connect : public cursor_by_thread_connect_attr 63 { 64 protected: 65 table_session_connect(const PFS_engine_table_share *share); 66 67 public: 68 ~table_session_connect(); 69 70 protected: 71 virtual void make_row(PFS_thread *pfs, uint ordinal); 72 virtual bool thread_fits(PFS_thread *thread); 73 virtual int read_row_values(TABLE *table, unsigned char *buf, 74 Field **fields, bool read_all); 75 protected: 76 /** Fields definition. */ 77 static TABLE_FIELD_DEF m_field_def; 78 /** Current row. */ 79 row_session_connect_attrs m_row; 80 /** Safe copy of @c PFS_thread::m_session_connect_attrs. */ 81 char *m_copy_session_connect_attrs; 82 /** Safe copy of @c PFS_thread::m_session_connect_attrs_length. */ 83 uint m_copy_session_connect_attrs_length; 84 }; 85 86 /** @} */ 87 #endif 88