MySQL 9.1.0
Source Code Documentation
common.cc File Reference
#include "common.h"
#include <sddl.h>
#include <secext.h>
#include "my_dbug.h"

Functions

template<>
void error_log_print< error_log_level::INFO > (const char *fmt,...)
 
template<>
void error_log_print< error_log_level::WARNING > (const char *fmt,...)
 
template<>
void error_log_print< error_log_level::ERROR > (const char *fmt,...)
 
char * wchar_to_utf8 (const wchar_t *string, size_t *len)
 Convert a wide-char string to utf8 representation. More...
 
wchar_t * utf8_to_wchar (const char *string, size_t *len)
 Convert an utf8 string to a wide-char string. More...
 
const char * get_last_error_message (Error_message_buf buf)
 Error handling. More...
 

Variables

int opt_auth_win_log_level = 2
 Option indicating desired level of logging. More...
 

Function Documentation

◆ error_log_print< error_log_level::ERROR >()

template<>
void error_log_print< error_log_level::ERROR > ( const char *  fmt,
  ... 
)

◆ error_log_print< error_log_level::INFO >()

template<>
void error_log_print< error_log_level::INFO > ( const char *  fmt,
  ... 
)

◆ error_log_print< error_log_level::WARNING >()

template<>
void error_log_print< error_log_level::WARNING > ( const char *  fmt,
  ... 
)

◆ get_last_error_message()

const char * get_last_error_message ( Error_message_buf  buf)

Error handling.

Returns error message corresponding to the last Windows error given by GetLastError().

Note
Error message is overwritten by next call to get_last_error_message().

◆ utf8_to_wchar()

wchar_t * utf8_to_wchar ( const char *  string,
size_t *  len 
)

Convert an utf8 string to a wide-char string.

Parameters
[in]stringnull-terminated utf8 string to be converted
[in,out]lenlength of the string to be converted or 0; on return length (in chars) of the converted string

If len is 0 then the length of the string will be computed by this function.

Returns
Pointer to a buffer containing wide-char representation or nullptr in case of error.
Note
The returned buffer must be freed with free() call.

◆ wchar_to_utf8()

char * wchar_to_utf8 ( const wchar_t *  string,
size_t *  len 
)

Convert a wide-char string to utf8 representation.

Parameters
[in]stringnull-terminated wide-char string to be converted
[in,out]lenlength of the string to be converted or 0; on return length (in bytes, excluding terminating null character) of the converted string

If len is 0 then the length of the string will be computed by this function.

Returns
Pointer to a buffer containing utf8 representation or nullptr in case of error.
Note
The returned buffer must be freed with free() call.

Variable Documentation

◆ opt_auth_win_log_level

int opt_auth_win_log_level = 2

Option indicating desired level of logging.

Values:

0 - no logging 1 - log only error messages 2 - additionally log warnings 3 - additionally log info notes 4 - also log debug messages

Value of this option should be taken into account in the implementation of error_log_vprint() function (see log_client.cc).

Note: No error or debug messages are logged in production code (see logging macros in common.h).