MySQL 9.1.0
Source Code Documentation
table_session_connect.h
Go to the documentation of this file.
1/* Copyright (c) 2012, 2024, 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 designed to work 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 either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef TABLE_SESSION_CONNECT_H
25#define TABLE_SESSION_CONNECT_H
26
27/**
28 @file storage/perfschema/table_session_connect.h
29 TABLE SESSION_CONNECT (abstract)
30*/
31
32#include <sys/types.h>
33
37
38struct CHARSET_INFO;
39
40#define MAX_ATTR_NAME_CHARS 32
41#define MAX_ATTR_VALUE_CHARS 1024
42#define MAX_UTF8MB4_BYTES 4
43
44/** symbolic names for field offsets, keep in sync with field_types */
50};
51
52/**
53 A row of PERFORMANCE_SCHEMA.SESSION_CONNECT_ATTRS and
54 PERFORMANCE_SCHEMA.SESSION_ACCOUNT_CONNECT_ATTRS.
55*/
57 /** Column PROCESS_ID. */
59 /** Column ATTR_NAME. In UTF8MB4 */
61 /** Length in bytes of @c m_attr_name. */
63 /** Column ATTR_VALUE. In UTF8MB4 */
65 /** Length in bytes of @c m_attr_name. */
67 /** Column ORDINAL_POSITION. */
69};
70
72 public:
75 m_key_1("PROCESSLIST_ID"),
76 m_key_2("ATTR_NAME") {}
77
78 ~PFS_index_session_connect() override = default;
79
80 virtual bool match(PFS_thread *pfs);
81 virtual bool match(row_session_connect_attrs *row);
82
83 private:
86};
87
88/** Abstract table PERFORMANCE_SCHEMA.SESSION_CONNECT_ATTRS. */
90 protected:
91 explicit table_session_connect(const PFS_engine_table_share *share);
92
93 public:
94 ~table_session_connect() override;
95
96 protected:
97 int index_init(uint idx, bool sorted) override;
98 int index_next() override;
99
100 int make_row(PFS_thread *pfs, uint ordinal) override;
101 virtual bool thread_fits(PFS_thread *thread);
102 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
103 bool read_all) override;
104
105 protected:
106 /** Current row. */
108 /** Safe copy of @c PFS_thread::m_session_connect_attrs. */
110 /** Safe copy of @c PFS_thread::m_session_connect_attrs_length. */
112
114};
115
116bool read_nth_attr(const char *connect_attrs, uint connect_attrs_length,
117 const CHARSET_INFO *connect_attrs_cs, uint ordinal,
118 char *attr_name, uint max_attr_name, uint *attr_name_length,
119 char *attr_value, uint max_attr_value,
120 uint *attr_value_length);
121
122#endif
Definition: field.h:577
Definition: pfs_engine_table.h:301
Definition: table_session_connect.h:71
virtual bool match(PFS_thread *pfs)
Definition: table_session_connect.cc:41
~PFS_index_session_connect() override=default
PFS_index_session_connect()
Definition: table_session_connect.h:73
PFS_key_name m_key_2
Definition: table_session_connect.h:85
PFS_key_processlist_id m_key_1
Definition: table_session_connect.h:84
Definition: table_helper.h:1569
Definition: table_helper.h:1309
Cursor CURSOR_BY_THREAD_CONNECT_ATTR.
Definition: cursor_by_thread_connect_attr.h:61
Abstract table PERFORMANCE_SCHEMA.SESSION_CONNECT_ATTRS.
Definition: table_session_connect.h:89
int index_init(uint idx, bool sorted) override
Definition: table_session_connect.cc:77
~table_session_connect() override
Definition: table_session_connect.cc:73
table_session_connect(const PFS_engine_table_share *share)
Definition: table_session_connect.cc:61
int index_next() override
Find key in index, read record.
Definition: table_session_connect.cc:84
char * m_copy_session_connect_attrs
Safe copy of PFS_thread::m_session_connect_attrs.
Definition: table_session_connect.h:109
uint m_copy_session_connect_attrs_length
Safe copy of PFS_thread::m_session_connect_attrs_length.
Definition: table_session_connect.h:111
PFS_index_session_connect * m_opened_index
Definition: table_session_connect.h:113
row_session_connect_attrs m_row
Current row.
Definition: table_session_connect.h:107
int make_row(PFS_thread *pfs, uint ordinal) override
Definition: table_session_connect.cc:236
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_session_connect.cc:312
virtual bool thread_fits(PFS_thread *thread)
Definition: table_session_connect.cc:353
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Definition: buf0block_hint.cc:30
Data types for columns used in the performance schema tables (declarations)
static const LEX_CSTRING pfs
Definition: sql_show_processlist.cc:66
Definition: m_ctype.h:421
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:359
Instrumented thread implementation.
Definition: pfs_instr.h:375
Definition: table.h:1421
A row of PERFORMANCE_SCHEMA.SESSION_CONNECT_ATTRS and PERFORMANCE_SCHEMA.SESSION_ACCOUNT_CONNECT_ATTR...
Definition: table_session_connect.h:56
char m_attr_name[MAX_ATTR_NAME_CHARS *MAX_UTF8MB4_BYTES]
Column ATTR_NAME.
Definition: table_session_connect.h:60
ulong m_process_id
Column PROCESS_ID.
Definition: table_session_connect.h:58
uint m_attr_value_length
Length in bytes of m_attr_name.
Definition: table_session_connect.h:66
char m_attr_value[MAX_ATTR_VALUE_CHARS *MAX_UTF8MB4_BYTES]
Column ATTR_VALUE.
Definition: table_session_connect.h:64
ulong m_ordinal_position
Column ORDINAL_POSITION.
Definition: table_session_connect.h:68
uint m_attr_name_length
Length in bytes of m_attr_name.
Definition: table_session_connect.h:62
Helpers to implement a performance schema table.
#define MAX_ATTR_VALUE_CHARS
Definition: table_session_connect.h:41
#define MAX_UTF8MB4_BYTES
Definition: table_session_connect.h:42
bool read_nth_attr(const char *connect_attrs, uint connect_attrs_length, const CHARSET_INFO *connect_attrs_cs, uint ordinal, char *attr_name, uint max_attr_name, uint *attr_name_length, char *attr_value, uint max_attr_value, uint *attr_value_length)
Take the nth attribute name/value pair.
Definition: table_session_connect.cc:192
field_offsets
symbolic names for field offsets, keep in sync with field_types
Definition: table_session_connect.h:45
@ FO_ORDINAL_POSITION
Definition: table_session_connect.h:49
@ FO_ATTR_NAME
Definition: table_session_connect.h:47
@ FO_ATTR_VALUE
Definition: table_session_connect.h:48
@ FO_PROCESS_ID
Definition: table_session_connect.h:46
#define MAX_ATTR_NAME_CHARS
Definition: table_session_connect.h:40