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