MySQL 8.0.39
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
38#define MAX_ATTR_NAME_CHARS 32
39#define MAX_ATTR_VALUE_CHARS 1024
40#define MAX_UTF8MB4_BYTES 4
41
42/** symbolic names for field offsets, keep in sync with field_types */
48};
49
50/**
51 A row of PERFORMANCE_SCHEMA.SESSION_CONNECT_ATTRS and
52 PERFORMANCE_SCHEMA.SESSION_ACCOUNT_CONNECT_ATTRS.
53*/
55 /** Column PROCESS_ID. */
57 /** Column ATTR_NAME. In UTF8MB4 */
59 /** Length in bytes of @c m_attr_name. */
61 /** Column ATTR_VALUE. In UTF8MB4 */
63 /** Length in bytes of @c m_attr_name. */
65 /** Column ORDINAL_POSITION. */
67};
68
70 public:
73 m_key_1("PROCESSLIST_ID"),
74 m_key_2("ATTR_NAME") {}
75
76 ~PFS_index_session_connect() override = default;
77
78 virtual bool match(PFS_thread *pfs);
79 virtual bool match(row_session_connect_attrs *row);
80
81 private:
84};
85
86/** Abstract table PERFORMANCE_SCHEMA.SESSION_CONNECT_ATTRS. */
88 protected:
89 explicit table_session_connect(const PFS_engine_table_share *share);
90
91 public:
92 ~table_session_connect() override;
93
94 protected:
95 int index_init(uint idx, bool sorted) override;
96 int index_next() override;
97
98 int make_row(PFS_thread *pfs, uint ordinal) override;
99 virtual bool thread_fits(PFS_thread *thread);
100 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
101 bool read_all) override;
102
103 protected:
104 /** Current row. */
106 /** Safe copy of @c PFS_thread::m_session_connect_attrs. */
108 /** Safe copy of @c PFS_thread::m_session_connect_attrs_length. */
110
112};
113
114bool read_nth_attr(const char *connect_attrs, uint connect_attrs_length,
115 const CHARSET_INFO *connect_attrs_cs, uint ordinal,
116 char *attr_name, uint max_attr_name, uint *attr_name_length,
117 char *attr_value, uint max_attr_value,
118 uint *attr_value_length);
119
120#endif
Definition: field.h:575
Definition: pfs_engine_table.h:300
Definition: table_session_connect.h:69
virtual bool match(PFS_thread *pfs)
Definition: table_session_connect.cc:39
~PFS_index_session_connect() override=default
PFS_index_session_connect()
Definition: table_session_connect.h:71
PFS_key_name m_key_2
Definition: table_session_connect.h:83
PFS_key_processlist_id m_key_1
Definition: table_session_connect.h:82
Definition: table_helper.h:1535
Definition: table_helper.h:1308
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:87
int index_init(uint idx, bool sorted) override
Definition: table_session_connect.cc:75
~table_session_connect() override
Definition: table_session_connect.cc:71
table_session_connect(const PFS_engine_table_share *share)
Definition: table_session_connect.cc:59
int index_next() override
Find key in index, read record.
Definition: table_session_connect.cc:82
char * m_copy_session_connect_attrs
Safe copy of PFS_thread::m_session_connect_attrs.
Definition: table_session_connect.h:107
uint m_copy_session_connect_attrs_length
Safe copy of PFS_thread::m_session_connect_attrs_length.
Definition: table_session_connect.h:109
PFS_index_session_connect * m_opened_index
Definition: table_session_connect.h:111
row_session_connect_attrs m_row
Current row.
Definition: table_session_connect.h:105
int make_row(PFS_thread *pfs, uint ordinal) override
Definition: table_session_connect.cc:234
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:310
virtual bool thread_fits(PFS_thread *thread)
Definition: table_session_connect.cc:351
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:385
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:358
Instrumented thread implementation.
Definition: pfs_instr.h:373
Definition: table.h:1399
A row of PERFORMANCE_SCHEMA.SESSION_CONNECT_ATTRS and PERFORMANCE_SCHEMA.SESSION_ACCOUNT_CONNECT_ATTR...
Definition: table_session_connect.h:54
char m_attr_name[MAX_ATTR_NAME_CHARS *MAX_UTF8MB4_BYTES]
Column ATTR_NAME.
Definition: table_session_connect.h:58
ulong m_process_id
Column PROCESS_ID.
Definition: table_session_connect.h:56
uint m_attr_value_length
Length in bytes of m_attr_name.
Definition: table_session_connect.h:64
char m_attr_value[MAX_ATTR_VALUE_CHARS *MAX_UTF8MB4_BYTES]
Column ATTR_VALUE.
Definition: table_session_connect.h:62
ulong m_ordinal_position
Column ORDINAL_POSITION.
Definition: table_session_connect.h:66
uint m_attr_name_length
Length in bytes of m_attr_name.
Definition: table_session_connect.h:60
Helpers to implement a performance schema table.
#define MAX_ATTR_VALUE_CHARS
Definition: table_session_connect.h:39
#define MAX_UTF8MB4_BYTES
Definition: table_session_connect.h:40
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:190
field_offsets
symbolic names for field offsets, keep in sync with field_types
Definition: table_session_connect.h:43
@ FO_ORDINAL_POSITION
Definition: table_session_connect.h:47
@ FO_ATTR_NAME
Definition: table_session_connect.h:45
@ FO_ATTR_VALUE
Definition: table_session_connect.h:46
@ FO_PROCESS_ID
Definition: table_session_connect.h:44
#define MAX_ATTR_NAME_CHARS
Definition: table_session_connect.h:38
unsigned int uint
Definition: uca9-dump.cc:75