D.S

dev.mysql.com

MySQL: mysys/my_error.cc File Reference

MySQL: mysys/my_error.cc File Reference MySQL  8.0.0 Source Code Documentation Main Page Related Pages Modules Namespaces Classes Files File List File Members Classes | Macros | Functions | Variables my_error.cc File Reference #include " mysys_priv.h " #include " my_sys.h " #include " mysys_err.h " #include < m_string.h > #include <stdarg.h> #include < m_ctype.h > #include " my_base.h " #include " my_handler_errors.h " #include " my_thread_local.h " #include " mysql/service_my_snprintf.h " #include " mysql/service_mysql_alloc.h " Classes struct   my_err_head   Macros #define  ERRMSGSIZE    (512)   Functions char *  my_strerror (char *buf, size_t len, int nr)   Get a string describing a system or handler error. More...   const char *  my_get_err_msg (int nr)   Get an error format string from one of the my_error_register() ed sets. More...   void  my_error (int nr, myf MyFlags,...)   Fill in and print a previously registered error message. More...   void  my_printf_error ( uint error , const char *format, myf MyFlags,...)   Print an error message. More...   void  my_printv_error ( uint error , const char *format, myf MyFlags, va_list ap)   Print an error message. More...   void  my_message ( uint error , const char *str, myf MyFlags)   Print an error message. More...   int  my_error_register (const char *(*get_errmsg)(int), int first, int last)   Register error messages for use with my_error() . More...   my_bool   my_error_unregister (int first, int last)   Unregister formerly registered error messages. More...   void  my_error_unregister_all (void)   Unregister all formerly registered error messages. More...   void  my_message_local_stderr (enum loglevel ll, const char *format, va_list args)   Issue a message locally (i.e. More...   void  my_message_local (enum loglevel ll, const char *format,...)   Issue a message locally (i.e. More...   Variables static struct my_err_head   my_errmsgs_globerrs = {NULL, get_global_errmsg , EE_ERROR_FIRST , EE_ERROR_LAST }   static struct my_err_head *  my_errmsgs_list = & my_errmsgs_globerrs   Macro Definition Documentation #define ERRMSGSIZE   (512) Function Documentation void my_error ( int  nr, myf   MyFlags,   ...  ) Fill in and print a previously registered error message. Note Goes through the (sole) function registered in error_handler_hook Parameters nr error number MyFlags Flags ... variable list matching that error format string int my_error_register ( const char *(*)(int)  get_errmsg, int  first, int  last  ) Register error messages for use with my_error() . The function is expected to return addresses to NUL-terminated C character strings. NULL pointers and empty strings ("") are allowed. These will be mapped to "Unknown error" when my_error() is called with a matching error number. This function registers the error numbers 'first' to 'last'. No overlapping with previously registered error numbers is allowed. Parameters get_errmsg function that returns error messages first error number of first message in the array last error number of last message in the array Return values 0 OK != 0 Error my_bool my_error_unregister ( int  first, int  last  ) Unregister formerly registered error messages. This function unregisters the error numbers 'first' to 'last'. These must have been previously registered by my_error_register() . 'first' and 'last' must exactly match the registration. If a matching registration is present, the header is removed from the list. Parameters first error number of first message last error number of last message Return values TRUE Error, no such number range registered. FALSE OK void my_error_unregister_all ( void  ) Unregister all formerly registered error messages. This function unregisters all error numbers that previously have been previously registered by my_error_register() . All headers are removed from the list; the messages themselves are not released here as they may be static. const char* my_get_err_msg ( int  nr ) Get an error format string from one of the my_error_register() ed sets. Note NULL values are possible even within a registered range. Parameters nr Errno Return values NULL if no message is registered for this error number str C-string void my_message ( uint   error, const char *  str, myf   MyFlags  ) Print an error message. Note Goes through the (sole) function registered in error_handler_hook Parameters error error number str error message MyFlags Flags void my_message_local ( enum loglevel   ll, const char *  format,   ...  ) Issue a message locally (i.e. on the same host the program is running on, don't transmit to a client). This goes through local_message_hook, i.e. by default, it calls my_message_local_stderr() which prepends an Error/Warning/Note label to the string, then prints it to stderr. More advanced programs can use their own printers; mysqld for instance uses its own error log facilities which prepend an ISO 8601 / RFC 3339 compliant timestamp etc. Parameters ll log level: (ERROR|WARNING|INFORMATION)_LEVEL t