MySQL  8.0.17
Source Code Documentation
mysql_runtime_error_service.h
Go to the documentation of this file.
1 /* Copyright (c) 2018, 2019, 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 MYSQL_RUNTIME_ERROR_SERVICE_H
24 #define MYSQL_RUNTIME_ERROR_SERVICE_H
25 
26 //! @cond Doxygen_Suppress
28 //! @endcond
31 //! @cond Doxygen_Suppress
32 #include <stdarg.h>
33 //! @endcond
34 
36 
37 /**
38  This function is substitute api service for my_error function.
39  To use this api, mysql_runtime_error service has to be acquired by the caller.
40  To use this api, components has to define
41  REQUIRES_SERVICE(mysql_runtime_error) and pass it to this api.
42 */
44  error_svc_handle,
45  int error_id, int flags, ...) {
46  va_list args;
47  va_start(args, flags);
48  error_svc_handle->emit(error_id, flags, args);
49  va_end(args);
50 }
51 
52 /**
53  This function can be used in components code as a replacement for my_error()
54  server function.
55  To use this api, components has to define
56  REQUIRES_SERVICE_PLACEHOLDER(mysql_runtime_error) and
57  REQUIRES_SERVICE(mysql_runtime_error).
58 */
59 inline void mysql_error_service_printf(int error_id, int flags, ...) {
60  va_list args;
61  va_start(args, flags);
62  mysql_service_mysql_runtime_error->emit(error_id, flags, args);
63  va_end(args);
64 }
65 
66 #ifndef MYSQL_SERVER
67 #define my_error mysql_error_service_printf
68 #endif
69 
70 #endif /* MYSQL_RUNTIME_ERROR_SERVICE_H */
Specifies macros to define Components.
#define SERVICE_TYPE(name)
void mysql_error_service_printf(int error_id, int flags,...)
This function can be used in components code as a replacement for my_error() server function...
Definition: mysql_runtime_error_service.h:59
Definition: test_mysql_runtime_error.cc:29
REQUIRES_SERVICE_PLACEHOLDER(mysql_runtime_error)
void mysql_error_service_emit_printf(const mysql_service_mysql_runtime_error_t *error_svc_handle, int error_id, int flags,...)
This function is substitute api service for my_error function.
Definition: mysql_runtime_error_service.h:43
static int flags[50]
Definition: hp_test1.cc:39