MySQL 8.4.2
Source Code Documentation
mysql_query_attributes.h
Go to the documentation of this file.
1/* Copyright (c) 2019, 2024, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License, version 2.0,
5as published by the Free Software Foundation.
6
7This program is designed to work with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation. The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have either included with
13the program or referenced in the documentation.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License, version 2.0, for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef MYSQL_QUERY_ATTRIBUTES_H
25#define MYSQL_QUERY_ATTRIBUTES_H
26
27#include <field_types.h>
30
31#ifdef __cplusplus
32class THD;
33#define MYSQL_THD THD *
34#else
35#define MYSQL_THD void *
36#endif
37
39
40/**
41 @ingroup group_components_services_inventory
42
43 A service to fetch the query attributes for the current thread
44
45 Use in conjunction with all the related services that operate on thread ids
46 @sa mysql_component_mysql_query_attributes_imp
47*/
48BEGIN_SERVICE_DEFINITION(mysql_query_attributes_iterator)
49/**
50 Creates iterator that iterates through all parameters supplied.
51 The iterator will be positioned at the first parameter if any.
52
53 @param thd The thread handle for the thread you want data for. It NULL it
54 will read the current thread.
55 @param name The name of the parameter to position on. UTF8mb4. if non-NULL
56 will position the iterator on the first occurrence of a parameter
57 with the specified name, if any.
58 @param [out] out_iterator place to store the iterator handle.
59 @return Status of performed operation
60 @retval false success. Can read data.
61 @retval true failure. Either failed to initialize iterator or no parameters
62 to read.
63*/
64DECLARE_BOOL_METHOD(create, (MYSQL_THD thd, const char *name,
66/**
67 Gets the type of element pointed to by the iterator.
68
69 @param iterator query attributes iterator handle.
70 @param [out] out_type place to store the parameter type.
71 @return status of performed operation
72 @retval false success
73 @retval true Invalid iterator or not on an element
74*/
76 enum enum_field_types *out_type));
77/**
78 Advances specified iterator to next element.
79
80 @param iterator iterator handle to advance.
81 @return Status of performed operation and validity of iterator after
82 operation.
83 @retval false success
84 @retval true Failure or no more elements
85*/
87/**
88 Gets the name of the parameter.
89
90 @param iterator query attributes iterator handle.
91 @param[out] out_name_handle the name of the parameter if supplied.
92 Otherwise a nullptr.
93 @return status of operation
94 @retval false Valid
95 @retval true Invalid iterator or not on an element
96*/
98 my_h_string *out_name_handle));
99/**
100 Releases the Service Implementations iterator. Releases read lock on the
101 Registry.
102
103 @param iterator Service Implementation iterator handle.
104 @return Status of performed operation
105 @retval false success
106 @retval true failure
107*/
109END_SERVICE_DEFINITION(mysql_query_attributes_iterator)
110
111/**
112 @ingroup group_components_services_inventory
113
114 A service to fetch the query attribute value as a string
115
116 Use in conjunction with mysql_query_atrributes_iterator service
117
118 @sa mysql_component_mysql_query_attributes_imp
119*/
121/**
122 Gets the parameter as a string
123
124 @param iterator query attributes iterator handle.
125 @param[out] out_string_value the value.
126 @return status of operation
127 @retval false success. out_string_value valid
128 @retval true Invalid iterator or a null value
129*/
131 my_h_string *out_string_value));
133
134/**
135 @ingroup group_components_services_inventory
136
137 A service to fetch the query attribute null flag
138
139 Use in conjunction with mysql_query_atrributes_iterator service
140
141 @sa mysql_component_mysql_query_attributes_imp
142*/
143BEGIN_SERVICE_DEFINITION(mysql_query_attribute_isnull)
144/**
145 Checks if the parameter value is a null
146
147 @param iterator query attributes iterator handle.
148 @param[out] out_null set to true if the value is NULL. false otherwise.
149 @return status of operation
150 @retval false success. out_null valid
151 @retval true Invalid iterator no current element
152*/
154 bool *out_null));
155END_SERVICE_DEFINITION(mysql_query_attribute_isnull)
156
157#endif /* MYSQL_QUERY_ATTRIBUTES_H */
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
This file contains the field type.
enum_field_types
Column types for MySQL Note: Keep include/mysql/components/services/bits/stored_program_bits....
Definition: field_types.h:55
#define MYSQL_THD
Definition: mysql_query_attributes.h:33
struct mysqlh_query_attributes_iterator_imp * mysqlh_query_attributes_iterator
Definition: mysql_query_attributes.h:38
void get(PSI_field *, PSI_longlong *) noexcept
Definition: pfs_plugin_column_bigint_v1_all_empty.cc:32
static mysql_service_status_t create(const char *service_names[], reference_caching_channel *out_channel) noexcept
Definition: component.cc:45
static char * mysql_query_attribute_string(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned long *length, unsigned char *is_null, unsigned char *error)
Definition: query_attributes.cc:52
#define DECLARE_METHOD(retval, name, args)
Declares a method as a part of the Service definition.
Definition: service.h:103
#define END_SERVICE_DEFINITION(name)
A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro.
Definition: service.h:91
#define BEGIN_SERVICE_DEFINITION(name)
Declares a new Service.
Definition: service.h:86
#define DEFINE_SERVICE_HANDLE(name)
Defines an object type that is meant for carrying handles to the implementation-specific objects used...
Definition: service.h:129
#define DECLARE_BOOL_METHOD(name, args)
Declares a method that returns bool as a part of the Service definition.
Definition: service.h:112
case opt name
Definition: sslopt-case.h:29
Definition: mysql_string_service.cc:60
const char * get_type(TYPELIB *typelib, unsigned int nr)