| 1 | /* Copyright (c) 2016, MariaDB |
| 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 as published by |
| 5 | the Free Software Foundation; version 2 of the License. |
| 6 | |
| 7 | This program is distributed in the hope that it will be useful, |
| 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | GNU General Public License for more details. |
| 11 | |
| 12 | You should have received a copy of the GNU General Public License |
| 13 | along with this program; if not, write to the Free Software |
| 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
| 15 | |
| 16 | #ifndef MYSQL_SERVICE_MY_PRINT_ERROR_INCLUDED |
| 17 | #define MYSQL_SERVICE_MY_PRINT_ERROR_INCLUDED |
| 18 | |
| 19 | /** |
| 20 | @file include/mysql/service_my_print_error.h |
| 21 | |
| 22 | This service provides functions for plugins to report |
| 23 | errors to client (without client, the errors are written to the error log). |
| 24 | |
| 25 | */ |
| 26 | #ifdef __cplusplus |
| 27 | extern "C" { |
| 28 | #endif |
| 29 | |
| 30 | #ifndef MYSQL_ABI_CHECK |
| 31 | #include <stdarg.h> |
| 32 | #include <stdlib.h> |
| 33 | #endif |
| 34 | |
| 35 | #define ME_ERROR_LOG 64 /* Write the message to the error log */ |
| 36 | #define ME_NOTE 1024 /* Not an error, just a note */ |
| 37 | #define ME_WARNING 2048 /* Not an error, just a warning */ |
| 38 | #define ME_FATAL 4096 /* Fatal statement error */ |
| 39 | |
| 40 | extern struct my_print_error_service_st { |
| 41 | void (*my_error_func)(unsigned int nr, unsigned long MyFlags, ...); |
| 42 | void (*my_printf_error_func)(unsigned int nr, const char *fmt, unsigned long MyFlags,...); |
| 43 | void (*my_printv_error_func)(unsigned int error, const char *format, unsigned long MyFlags, va_list ap); |
| 44 | } *my_print_error_service; |
| 45 | |
| 46 | #ifdef MYSQL_DYNAMIC_PLUGIN |
| 47 | |
| 48 | #define my_error my_print_error_service->my_error_func |
| 49 | #define my_printf_error my_print_error_service->my_printf_error_func |
| 50 | #define my_printv_error(A,B,C,D) my_print_error_service->my_printv_error_func(A,B,C,D) |
| 51 | |
| 52 | #else |
| 53 | #ifndef MY_ERROR_DEFINED |
| 54 | extern void my_error(unsigned int nr, unsigned long MyFlags, ...); |
| 55 | extern void my_printf_error(unsigned int my_err, const char *format, unsigned long MyFlags, ...); |
| 56 | extern void my_printv_error(unsigned int error, const char *format, unsigned long MyFlags,va_list ap); |
| 57 | #endif /* MY_ERROR_DEFINED */ |
| 58 | #endif /* MYSQL_DYNAMIC_PLUGIN */ |
| 59 | |
| 60 | #ifdef __cplusplus |
| 61 | } |
| 62 | #endif |
| 63 | |
| 64 | #endif |
| 65 | |
| 66 | |