MySQL 8.0.33
Source Code Documentation
table_session_connect.h
Go to the documentation of this file.
1/* Copyright (c) 2012, 2023, 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 St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef TABLE_SESSION_CONNECT_H
24#define TABLE_SESSION_CONNECT_H
25
26/**
27 @file storage/perfschema/table_session_connect.h
28 TABLE SESSION_CONNECT (abstract)
29*/
30
31#include <sys/types.h>
32
36
37#define MAX_ATTR_NAME_CHARS 32
38#define MAX_ATTR_VALUE_CHARS 1024
39#define MAX_UTF8MB4_BYTES 4
40
41/** symbolic names for field offsets, keep in sync with field_types */
47};
48
49/**
50 A row of PERFORMANCE_SCHEMA.SESSION_CONNECT_ATTRS and
51 PERFORMANCE_SCHEMA.SESSION_ACCOUNT_CONNECT_ATTRS.
52*/
54 /** Column PROCESS_ID. */
56 /** Column ATTR_NAME. In UTF8MB4 */
58 /** Length in bytes of @c m_attr_name. */
60 /** Column ATTR_VALUE. In UTF8MB4 */
62 /** Length in bytes of @c m_attr_name. */
64 /** Column ORDINAL_POSITION. */
66};
67
69 public:
72 m_key_1("PROCESSLIST_ID"),
73 m_key_2("ATTR_NAME") {}
74
75 ~PFS_index_session_connect() override = default;
76
77 virtual bool match(PFS_thread *pfs);
78 virtual bool match(row_session_connect_attrs *row);
79
80 private:
83};
84
85/** Abstract table PERFORMANCE_SCHEMA.SESSION_CONNECT_ATTRS. */
87 protected:
88 explicit table_session_connect(const PFS_engine_table_share *share);
89
90 public:
91 ~table_session_connect() override;
92
93 protected:
94 int index_init(uint idx, bool sorted) override;
95 int index_next() override;
96
97 int make_row(PFS_thread *pfs, uint ordinal) override;
98 virtual bool thread_fits(PFS_thread *thread);
99 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
100 bool read_all) override;
101
102 protected:
103 /** Current row. */
105 /** Safe copy of @c PFS_thread::m_session_connect_attrs. */
107 /** Safe copy of @c PFS_thread::m_session_connect_attrs_length. */
109
111};
112
113bool read_nth_attr(const char *connect_attrs, uint connect_attrs_length,
114 const CHARSET_INFO *connect_attrs_cs, uint ordinal,
115 char *attr_name, uint max_attr_name, uint *attr_name_length,
116 char *attr_value, uint max_attr_value,
117 uint *attr_value_length);
118
119#endif
Definition: field.h:574
Definition: pfs_engine_table.h:299
Definition: table_session_connect.h:68
virtual bool match(PFS_thread *pfs)
Definition: table_session_connect.cc:38
~PFS_index_session_connect() override=default
PFS_index_session_connect()
Definition: table_session_connect.h:70
PFS_key_name m_key_2
Definition: table_session_connect.h:82
PFS_key_processlist_id m_key_1
Definition: table_session_connect.h:81
Definition: table_helper.h:1507
Definition: table_helper.h:1280
Cursor CURSOR_BY_THREAD_CONNECT_ATTR.
Definition: cursor_by_thread_connect_attr.h:60
Abstract table PERFORMANCE_SCHEMA.SESSION_CONNECT_ATTRS.
Definition: table_session_connect.h:86
int index_init(uint idx, bool sorted) override
Definition: table_session_connect.cc:74
~table_session_connect() override
Definition: table_session_connect.cc:70
table_session_connect(const PFS_engine_table_share *share)
Definition: table_session_connect.cc:58
int index_next() override
Find key in index, read record.
Definition: table_session_connect.cc:81
char * m_copy_session_connect_attrs
Safe copy of PFS_thread::m_session_connect_attrs.
Definition: table_session_connect.h:106
uint m_copy_session_connect_attrs_length
Safe copy of PFS_thread::m_session_connect_attrs_length.
Definition: table_session_connect.h:108
PFS_index_session_connect * m_opened_index
Definition: table_session_connect.h:110
row_session_connect_attrs m_row
Current row.
Definition: table_session_connect.h:104
int make_row(PFS_thread *pfs, uint ordinal) override
Definition: table_session_connect.cc:233
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:309
virtual bool thread_fits(PFS_thread *thread)
Definition: table_session_connect.cc:350
Definition: buf0block_hint.cc:29
Data types for columns used in the performance schema tables (declarations)
static const LEX_CSTRING pfs
Definition: sql_show_processlist.cc:65
Definition: m_ctype.h:382
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:357
Instrumented thread implementation.
Definition: pfs_instr.h:372
Definition: table.h:1395
A row of PERFORMANCE_SCHEMA.SESSION_CONNECT_ATTRS and PERFORMANCE_SCHEMA.SESSION_ACCOUNT_CONNECT_ATTR...
Definition: table_session_connect.h:53
char m_attr_name[MAX_ATTR_NAME_CHARS *MAX_UTF8MB4_BYTES]
Column ATTR_NAME.
Definition: table_session_connect.h:57
ulong m_process_id
Column PROCESS_ID.
Definition: table_session_connect.h:55
uint m_attr_value_length
Length in bytes of m_attr_name.
Definition: table_session_connect.h:63
char m_attr_value[MAX_ATTR_VALUE_CHARS *MAX_UTF8MB4_BYTES]
Column ATTR_VALUE.
Definition: table_session_connect.h:61
ulong m_ordinal_position
Column ORDINAL_POSITION.
Definition: table_session_connect.h:65
uint m_attr_name_length
Length in bytes of m_attr_name.
Definition: table_session_connect.h:59
Helpers to implement a performance schema table.
#define MAX_ATTR_VALUE_CHARS
Definition: table_session_connect.h:38
#define MAX_UTF8MB4_BYTES
Definition: table_session_connect.h:39
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:189
field_offsets
symbolic names for field offsets, keep in sync with field_types
Definition: table_session_connect.h:42
@ FO_ORDINAL_POSITION
Definition: table_session_connect.h:46
@ FO_ATTR_NAME
Definition: table_session_connect.h:44
@ FO_ATTR_VALUE
Definition: table_session_connect.h:45
@ FO_PROCESS_ID
Definition: table_session_connect.h:43
#define MAX_ATTR_NAME_CHARS
Definition: table_session_connect.h:37
unsigned int uint
Definition: uca9-dump.cc:74