MySQL 8.4.3
Source Code Documentation
|
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include "lex_string.h"
#include "my_alloc.h"
#include "my_compiler.h"
#include "my_inttypes.h"
#include "mysql/strings/int2str.h"
#include "mysql/strings/m_ctype.h"
#include "mysql_com.h"
#include "sql/sql_list.h"
#include "sql/sql_plist.h"
#include "sql_string.h"
Go to the source code of this file.
Classes | |
class | Sql_condition |
Representation of a SQL condition. More... | |
class | ErrConvString |
class | Diagnostics_area |
Stores status of the currently executed statement. More... | |
Functions | |
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... | |
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 | 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... | |
bool | is_sqlstate_completion (const char *s) |
Checks if the specified SQL-state-string defines COMPLETION condition. More... | |
bool | is_sqlstate_warning (const char *s) |
Checks if the specified SQL-state-string defines WARNING condition. More... | |
bool | is_sqlstate_not_found (const char *s) |
Checks if the specified SQL-state-string defines NOT FOUND condition. More... | |
bool | is_sqlstate_exception (const char *s) |
Checks if the specified SQL-state-string defines EXCEPTION condition. More... | |
void | warn_on_deprecated_charset (THD *thd, const CHARSET_INFO *cs, const char *alias, const char *option=nullptr) |
Output warnings on deprecated character sets. More... | |
void | warn_on_deprecated_collation (THD *thd, const CHARSET_INFO *collation, const char *option=nullptr) |
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 | |
constexpr const size_t | WARN_ALLOC_BLOCK_SIZE {2048} |
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" |
|
inline |
Checks if the specified SQL-state-string defines COMPLETION condition.
This function assumes that the given string contains a valid SQL-state.
s | the condition SQLSTATE. |
true | if the given string defines COMPLETION condition. |
false | otherwise. |
|
inline |
Checks if the specified SQL-state-string defines EXCEPTION condition.
This function assumes that the given string contains a valid SQL-state.
s | the condition SQLSTATE. |
true | if the given string defines EXCEPTION condition. |
false | otherwise. |
|
inline |
Checks if the specified SQL-state-string defines NOT FOUND condition.
This function assumes that the given string contains a valid SQL-state.
s | the condition SQLSTATE. |
true | if the given string defines NOT FOUND condition. |
false | otherwise. |
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. |
|
inline |
Checks if the specified SQL-state-string defines WARNING condition.
This function assumes that the given string contains a valid SQL-state.
s | the condition SQLSTATE. |
true | if the given string defines WARNING condition. |
false | otherwise. |
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. |
|
constexpr |
|
extern |