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