MySQL 8.4.2
Source Code Documentation
utils.h
Go to the documentation of this file.
1/* Copyright (c) 2023, 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 RUN_COMMAND_UTILS_H
25#define RUN_COMMAND_UTILS_H
26
27#include "my_alloc.h"
29class THD;
30struct LEX;
31struct MEM_ROOT;
32struct CHARSET_INFO;
33
34/**
35 Sets multi-result state for SP being executed by the Statement_handle
36 family.
37
38 For SQL SP, flags required for multi-result are set while parsing SP
39 statements. SPs for which parsing its statement is deferred to execution
40 phase, multi-result state is set by this function.
41
42 The function invoker need not have to reset this state. State is reset
43 in the Sql_cmd_call::execute_inner.
44
45 @param thd Thread Handle.
46 @param lex Lex instance of SP statement.
47
48 @returns false on Success and true if multi-result can not be used.
49*/
50bool set_sp_multi_result_state(THD *thd, LEX *lex);
51
52/**
53 Set query to be displayed in performance schema.
54
55 @param thd Thread Handle.
56*/
57void set_query_for_display(THD *thd);
58
59/**
60 * @brief Potentially convert a string from src charset to destination charset
61 * and store the returned string on the specified memroot
62 *
63 * @param mem_root The mem_root to store the result str
64 * @param str The input string to be converted
65 * @param length Length of the input string
66 * @param src_cs Source charset
67 * @param dst_cs Dest charset
68 * @return char* Pointer to the converted string on the memroot
69 */
70char *convert_and_store(MEM_ROOT *mem_root, const char *str, size_t length,
71 const CHARSET_INFO *src_cs, const CHARSET_INFO *dst_cs);
72
73#endif
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
static MEM_ROOT mem_root
Definition: client_plugin.cc:114
A better implementation of the UNIX ctype(3) library.
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1081
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
char * convert_and_store(MEM_ROOT *mem_root, const char *str, size_t length, const CHARSET_INFO *src_cs, const CHARSET_INFO *dst_cs)
Potentially convert a string from src charset to destination charset and store the returned string on...
Definition: utils.cc:72
bool set_sp_multi_result_state(THD *thd, LEX *lex)
Sets multi-result state for SP being executed by the Statement_handle family.
Definition: utils.cc:32
void set_query_for_display(THD *thd)
Set query to be displayed in performance schema.
Definition: utils.cc:63
Definition: m_ctype.h:423
The LEX object currently serves three different purposes:
Definition: sql_lex.h:3823
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83