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