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