MySQL 8.4.3
Source Code Documentation
|
#include "sql/sql_error.h"
#include <float.h>
#include <stdarg.h>
#include <algorithm>
#include "decimal.h"
#include "m_string.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_macros.h"
#include "my_sys.h"
#include "my_time.h"
#include "mysql/components/services/bits/psi_bits.h"
#include "mysql/components/services/log_builtins.h"
#include "mysql/components/services/log_shared.h"
#include "mysql/strings/dtoa.h"
#include "mysql/strings/m_ctype.h"
#include "mysql_time.h"
#include "mysqld_error.h"
#include "sql-common/my_decimal.h"
#include "sql/derror.h"
#include "sql/item.h"
#include "sql/protocol.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/sql_lex.h"
#include "sql/system_variables.h"
#include "sql/thr_malloc.h"
#include "string_with_len.h"
#include "strmake.h"
Functions | |
static void | copy_string (MEM_ROOT *mem_root, String *dst, const String *src) |
void | push_warning (THD *thd, Sql_condition::enum_severity_level severity, uint code, const char *message_text) |
Push the warning to error list if there is still room in the list. More... | |
void | push_warning (THD *thd, uint code) |
Convenience function for sending a warning with level SL_WARNING and no arguments to the message. More... | |
void | push_warning_printf (THD *thd, Sql_condition::enum_severity_level severity, uint code, const char *format,...) |
Push the warning to error list if there is still room in the list. More... | |
void | push_deprecated_warn (THD *thd, const char *old_syntax, const char *new_syntax) |
Generates a warning that a feature is deprecated. More... | |
void | push_deprecated_warn_no_replacement (THD *thd, const char *old_syntax) |
Generates a warning that a feature is deprecated. More... | |
bool | mysqld_show_warnings (THD *thd, ulong levels_to_show) |
Send all notes, errors or warnings to the client in a result set. More... | |
size_t | err_conv (char *buff, size_t to_length, const char *from, size_t from_length, const CHARSET_INFO *from_cs) |
Convert value for dispatch to error message(see WL#751). More... | |
size_t | convert_error_message (char *to, size_t to_length, const CHARSET_INFO *to_cs, const char *from, size_t from_length, const CHARSET_INFO *from_cs, uint *errors) |
Convert string for dispatch to client(see WL#751). More... | |
bool | is_sqlstate_valid (const LEX_STRING *sqlstate) |
Sanity check for SQLSTATEs. More... | |
static bool | is_deprecated (const char *cs_name) |
void | warn_on_deprecated_charset (THD *thd, const CHARSET_INFO *cs, const char *alias, const char *option) |
Output warnings on deprecated character sets. More... | |
void | warn_on_deprecated_collation (THD *thd, const CHARSET_INFO *collation, const char *option) |
Output warnings on deprecated character collations. More... | |
void | check_deprecated_datetime_format (THD *thd, const CHARSET_INFO *cs, MYSQL_TIME_STATUS &status) |
Check if status contains a deprecation warning. More... | |
Variables | |
static LEX_CSTRING | sqlstate_origin [] |
const LEX_CSTRING | warning_level_names [] |
void check_deprecated_datetime_format | ( | THD * | thd, |
const CHARSET_INFO * | cs, | ||
MYSQL_TIME_STATUS & | status | ||
) |
Check if status contains a deprecation warning.
If it does, issue the warning and reset the status indication.
size_t convert_error_message | ( | char * | to, |
size_t | to_length, | ||
const CHARSET_INFO * | to_cs, | ||
const char * | from, | ||
size_t | from_length, | ||
const CHARSET_INFO * | from_cs, | ||
uint * | errors | ||
) |
Convert string for dispatch to client(see WL#751).
to | buffer to convert |
to_length | buffer length |
to_cs | chraset to convert |
from | string from convert |
from_length | string length |
from_cs | charset from convert |
errors | count of errors during conversion |
length | of converted string |
size_t err_conv | ( | char * | buff, |
size_t | to_length, | ||
const char * | from, | ||
size_t | from_length, | ||
const CHARSET_INFO * | from_cs | ||
) |
Convert value for dispatch to error message(see WL#751).
buff | buffer for converted string, 0-terminated |
to_length | size of the buffer |
from | string which should be converted |
from_length | string length |
from_cs | charset from convert |
number | of bytes written to "to" |
|
static |
bool is_sqlstate_valid | ( | const LEX_STRING * | sqlstate | ) |
Sanity check for SQLSTATEs.
The function does not check if it's really an existing SQL-state (there are just too many), it just checks string length and looks for bad characters.
sqlstate | the condition SQLSTATE. |
true | if it's ok. |
false | if it's bad. |
bool mysqld_show_warnings | ( | THD * | thd, |
ulong | levels_to_show | ||
) |
Send all notes, errors or warnings to the client in a result set.
The function takes into account the current LIMIT.
thd | Thread handler |
levels_to_show | Bitmap for which levels to show |
|
inline |
Generates a warning that a feature is deprecated.
Using it as push_deprecated_warn(thd, "BAD", "'GOOD'"); Will result in a warning: "The syntax 'BAD' is deprecated and will be removed in a future release. Please use 'GOOD' instead"
If a function is deprecated, it should implement Item_func::is_deprecated() to return true to prevent the usage of the function in the generated column expression.
thd | Thread context. If NULL, warning is written to the error log, otherwise the warning is sent to the client. |
old_syntax | Deprecated syntax. |
new_syntax | Replacement syntax. |
|
inline |
Generates a warning that a feature is deprecated.
Using it as push_deprecated_warn_no_replacement(thd, "old"); Will result in a warning: "The syntax 'old' is deprecated and will be removed in a future release.
If a function is deprecated, it should implement Item_func::is_deprecated() to return true to prevent the usage of the function in the generated column expression.
thd | Thread context. If NULL, warning is written to the error log, otherwise the warning is sent to the client. |
old_syntax | Deprecated syntax. |
void push_warning | ( | THD * | thd, |
Sql_condition::enum_severity_level | severity, | ||
uint | code, | ||
const char * | message_text | ||
) |
Push the warning to error list if there is still room in the list.
thd | Thread handle |
severity | Severity of warning (note, warning) |
code | Error number |
message_text | Clear error message |
void push_warning | ( | THD * | thd, |
uint | code | ||
) |
Convenience function for sending a warning with level SL_WARNING and no arguments to the message.
thd | The session to send the warning to. |
code | The warning number. |
void push_warning_printf | ( | THD * | thd, |
Sql_condition::enum_severity_level | severity, | ||
uint | code, | ||
const char * | format, | ||
... | |||
) |
Push the warning to error list if there is still room in the list.
thd | Thread handle |
severity | Severity of warning (note, warning) |
code | Error number |
format | Error message printf format, or nullptr to go by the error code. |
|
inline |
Output warnings on deprecated character sets.
[in] | thd | The connection handler. |
[in] | cs | The character set to check for a deprecation. |
[in] | alias | The name/alias of cs . |
[in] | option | Command line/config file option name, otherwise NULL. |
|
inline |
Output warnings on deprecated character collations.
[in] | thd | The connection handler. |
[in] | collation | The collation to check for a deprecation. |
[in] | option | Command line/config file option name, otherwise NULL. |
|
static |
const LEX_CSTRING warning_level_names[] |