MySQL 8.4.2
Source Code Documentation
auto_thd.h
Go to the documentation of this file.
1/* Copyright (c) 2016, 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 AUTO_THD_H
25#define AUTO_THD_H
26
27#include <sys/types.h>
28
29#include "my_compiler.h"
30#include "sql/error_handler.h"
31#include "sql/sql_error.h"
32
33/**
34 Self destroying THD.
35*/
37 public:
38 /**
39 Create THD object and initialize internal variables.
40 */
41 Auto_THD();
42
43 /**
44 Deinitialize THD.
45 */
46 ~Auto_THD() override;
47
48 /**
49 Error handler that prints error message on to the error log.
50
51 @param thd Current THD.
52 @param sql_errno Error id.
53 @param sqlstate State of the SQL error.
54 @param level Error level.
55 @param msg Message to be reported.
56
57 @return This function always return false.
58 */
59 bool handle_condition(class THD *thd [[maybe_unused]],
60 uint sql_errno [[maybe_unused]],
61 const char *sqlstate [[maybe_unused]],
63 [[maybe_unused]],
64 const char *msg) override;
65
66 /** Thd associated with the object. */
67 class THD *thd;
68};
69
70#endif // AUTO_THD_H
Self destroying THD.
Definition: auto_thd.h:36
Auto_THD()
Create THD object and initialize internal variables.
Definition: auto_thd.cc:36
~Auto_THD() override
Deinitialize THD.
Definition: auto_thd.cc:43
bool handle_condition(class THD *thd, uint sql_errno, const char *sqlstate, Sql_condition::enum_severity_level *level, const char *msg) override
Error handler that prints error message on to the error log.
Definition: auto_thd.cc:59
class THD * thd
Thd associated with the object.
Definition: auto_thd.h:67
This class represents the interface for internal error handlers.
Definition: error_handler.h:47
enum_severity_level
Enumeration value describing the severity of the condition.
Definition: sql_error.h:63
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Header for compiler-dependent features.