MySQL 8.3.0
Source Code Documentation
mysql_runtime_error_service.h
Go to the documentation of this file.
1/* Copyright (c) 2018, 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 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
35extern REQUIRES_SERVICE_PLACEHOLDER(mysql_runtime_error);
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*/
43inline void mysql_error_service_emit_printf(SERVICE_TYPE(mysql_runtime_error) *
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*/
59inline 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
66typedef int myf; /* Type of MyFlags in my_funcs */
67
68/* Macros for converting *constants* to the right type */
69#define MYF(v) (myf)(v)
70
71#ifndef MYSQL_SERVER
72#define my_error mysql_error_service_printf
73#endif
74
75#endif /* MYSQL_RUNTIME_ERROR_SERVICE_H */
Specifies macros to define Components.
static int flags[50]
Definition: hp_test1.cc:39
REQUIRES_SERVICE_PLACEHOLDER(mysql_runtime_error)
int myf
Definition: mysql_runtime_error_service.h:66
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
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
#define SERVICE_TYPE(name)
Generates the standard Service type name.
Definition: service.h:75