MySQL 9.1.0
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 "lex_string.h"
28#include "my_alloc.h"
30class THD;
31struct LEX;
32struct MEM_ROOT;
33struct CHARSET_INFO;
34
35/**
36 Sets multi-result state for SP being executed by the Statement_handle
37 family.
38
39 For SQL SP, flags required for multi-result are set while parsing SP
40 statements. SPs for which parsing its statement is deferred to execution
41 phase, multi-result state is set by this function.
42
43 The function invoker need not have to reset this state. State is reset
44 in the Sql_cmd_call::execute_inner.
45
46 @param thd Thread Handle.
47 @param lex Lex instance of SP statement.
48
49 @returns false on Success and true if multi-result can not be used.
50*/
51bool set_sp_multi_result_state(THD *thd, LEX *lex);
52
53/**
54 Set query to be displayed in performance schema.
55
56 @param thd Thread Handle.
57*/
58void set_query_for_display(THD *thd);
59
60/**
61 * @brief Potentially convert a string from src charset to destination charset
62 * and store the returned string on the specified memroot
63 *
64 * @param mem_root The mem_root to store the result str
65 * @param str The input string to be converted
66 * @param length Length of the input string
67 * @param src_cs Source charset
68 * @param dst_cs Dest charset
69 * @return LEX_CSTRING Pointer to the converted string on the memroot
70 */
72 size_t length, const CHARSET_INFO *src_cs,
73 const CHARSET_INFO *dst_cs);
74
75#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:1105
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
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
LEX_CSTRING 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
Definition: m_ctype.h:421
The LEX object currently serves three different purposes:
Definition: sql_lex.h:3844
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
Definition: mysql_lex_string.h:40