MySQL  8.0.17
Source Code Documentation
auto_thd.h
Go to the documentation of this file.
1 /* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
2 
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6 
7 This program is also distributed with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have included with MySQL.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, 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  virtual ~Auto_THD();
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  virtual bool handle_condition(class THD *thd MY_ATTRIBUTE((unused)),
59  uint sql_errno MY_ATTRIBUTE((unused)),
60  const char *sqlstate MY_ATTRIBUTE((unused)),
62  MY_ATTRIBUTE((unused)),
63  const char *msg);
64 
65  /** Thd associated with the object. */
66  class THD *thd;
67 };
68 
69 #endif // AUTO_THD_H
Header for compiler-dependent features.
unsigned int uint
Definition: uca-dump.cc:29
virtual ~Auto_THD()
Deinitialize THD.
Definition: auto_thd.cc:42
char msg[1024]
Definition: test_sql_9_sessions.cc:282
virtual bool handle_condition(class THD *thd, uint sql_errno, const char *sqlstate, Sql_condition::enum_severity_level *level, const char *msg)
Error handler that prints error message on to the error log.
Definition: auto_thd.cc:58
This class represents the interface for internal error handlers.
Definition: error_handler.h:46
class THD * thd
Thd associated with the object.
Definition: auto_thd.h:66
enum_severity_level
Enumeration value describing the severity of the condition.
Definition: sql_error.h:58
Self destroying THD.
Definition: auto_thd.h:35
Auto_THD()
Create THD object and initialize internal variables.
Definition: auto_thd.cc:35
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:777