MySQL 9.1.0
Source Code Documentation
table_user_defined_functions.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 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_USER_DEFINED_FUNCTIONS_H
25#define TABLE_USER_DEFINED_FUNCTIONS_H
26
27/**
28 @file storage/perfschema/table_user_defined_functions.h
29 Table USER_DEFINED_FUNCTIONS (declarations).
30*/
31
32#include <sys/types.h>
33
34#include "my_base.h"
35#include "my_inttypes.h"
36#include "mysql_com.h"
39
40class Field;
41class Plugin_table;
42class THD;
43struct TABLE;
44struct THR_LOCK;
45struct udf_func;
46
47/**
48 @addtogroup performance_schema_tables
49 @{
50*/
51
52/** A row of PERFORMANCE_SCHEMA.USER_DEFINED_FUNCTIONS. */
54 /** Column UDF_NAME. */
57 /** Column UDF_RETURN_TYPE. */
58 const char *m_return_type;
60 /** Column UDF_TYPE. */
61 const char *m_type;
63 /** Column UDF_LIBRARY. */
64 char m_library[1024];
66 /** Column UDF_USAGE_COUNT. */
68};
69
71 public:
73 : PFS_engine_index(key_1) {}
74
76
77 virtual bool match(const row_user_defined_functions *row) = 0;
78};
79
82 public:
85
87
88 bool match(const row_user_defined_functions *row) override;
89
90 private:
92};
93
94/** Table PERFORMANCE_SCHEMA.USER_DEFINED_FUNCTIONS. */
96 public:
97 /** Table share. */
100 static ha_rows get_row_count();
101
102 void reset_position() override;
103
104 int rnd_next() override;
105 int rnd_pos(const void *pos) override;
106
107 int index_init(uint idx, bool sorted) override;
108 int index_next() override;
109
110 protected:
111 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
112 bool read_all) override;
114
115 public:
116 ~table_user_defined_functions() override = default;
117
118 private:
119 void materialize(THD *thd);
120 static int make_row(const udf_func *entry, row_user_defined_functions *row);
121 static void materialize_udf_funcs(udf_func *udf, void *arg);
122
123 /** Table share lock. */
125
128 /** Current row. */
130 /** Current position. */
132 /** Next position. */
134
136
137 /** Table definition. */
139};
140
141/** @} */
142#endif
Definition: field.h:577
Definition: pfs_engine_table.h:301
Definition: pfs_engine_table.h:268
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:70
Definition: table_user_defined_functions.h:81
PFS_index_user_defined_functions_by_name()
Definition: table_user_defined_functions.h:83
PFS_key_name m_key
Definition: table_user_defined_functions.h:91
~PFS_index_user_defined_functions_by_name() override=default
bool match(const row_user_defined_functions *row) override
Definition: table_user_defined_functions.cc:72
Definition: table_user_defined_functions.h:70
PFS_index_user_defined_functions(PFS_engine_key *key_1)
Definition: table_user_defined_functions.h:72
virtual bool match(const row_user_defined_functions *row)=0
~PFS_index_user_defined_functions() override=default
Definition: table_helper.h:1569
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:40
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Table PERFORMANCE_SCHEMA.USER_DEFINED_FUNCTIONS.
Definition: table_user_defined_functions.h:95
void materialize(THD *thd)
Definition: table_user_defined_functions.cc:123
static int make_row(const udf_func *entry, row_user_defined_functions *row)
Definition: table_user_defined_functions.cc:155
static ha_rows get_row_count()
Definition: table_user_defined_functions.cc:93
int index_init(uint idx, bool sorted) override
Definition: table_user_defined_functions.cc:231
~table_user_defined_functions() override=default
int index_next() override
Find key in index, read record.
Definition: table_user_defined_functions.cc:248
row_user_defined_functions * m_row
Current row.
Definition: table_user_defined_functions.h:129
static THR_LOCK m_table_lock
Table share lock.
Definition: table_user_defined_functions.h:124
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_user_defined_functions.cc:207
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_user_defined_functions.cc:224
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_user_defined_functions.cc:263
uint m_row_count
Definition: table_user_defined_functions.h:127
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_user_defined_functions.cc:82
static void materialize_udf_funcs(udf_func *udf, void *arg)
Definition: table_user_defined_functions.cc:115
PFS_simple_index m_pos
Current position.
Definition: table_user_defined_functions.h:131
PFS_index_user_defined_functions * m_opened_index
Definition: table_user_defined_functions.h:135
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_user_defined_functions.cc:202
static Plugin_table m_table_def
Table definition.
Definition: table_user_defined_functions.h:138
PFS_simple_index m_next_pos
Next position.
Definition: table_user_defined_functions.h:133
table_user_defined_functions()
Definition: table_user_defined_functions.cc:101
row_user_defined_functions * m_all_rows
Definition: table_user_defined_functions.h:126
static PFS_engine_table_share m_share
Table share.
Definition: table_user_defined_functions.h:98
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1141
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
Common definition between mysql server & client.
#define NAME_CHAR_LEN
Field/table name length.
Definition: mysql_com.h:60
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Definition: buf0block_hint.cc:30
Performance schema tables (declarations).
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:359
Position of a cursor, for simple iterations.
Definition: pfs_engine_table.h:567
Definition: table.h:1421
Definition: thr_lock.h:139
Definition: completion_hash.h:35
A row of PERFORMANCE_SCHEMA.USER_DEFINED_FUNCTIONS.
Definition: table_user_defined_functions.h:53
uint m_return_type_length
Definition: table_user_defined_functions.h:59
char m_name[NAME_CHAR_LEN+1]
Column UDF_NAME.
Definition: table_user_defined_functions.h:55
uint m_type_length
Definition: table_user_defined_functions.h:62
char m_library[1024]
Column UDF_LIBRARY.
Definition: table_user_defined_functions.h:64
ulonglong m_usage_count
Column UDF_USAGE_COUNT.
Definition: table_user_defined_functions.h:67
const char * m_type
Column UDF_TYPE.
Definition: table_user_defined_functions.h:61
const char * m_return_type
Column UDF_RETURN_TYPE.
Definition: table_user_defined_functions.h:58
uint m_library_length
Definition: table_user_defined_functions.h:65
uint m_name_length
Definition: table_user_defined_functions.h:56
Definition: sql_udf.h:44
Helpers to implement a performance schema table.