MySQL 8.0.39
Source Code Documentation
|
#include <stddef.h>
#include <sys/types.h>
#include <cstring>
#include <utility>
#include "lex_string.h"
#include "m_ctype.h"
#include "my_inttypes.h"
#include "mysql/mysql_lex_string.h"
Go to the source code of this file.
Functions | |
ulonglong | find_set (const TYPELIB *lib, const char *x, size_t length, const CHARSET_INFO *cs, const char **err_pos, uint *err_len, bool *set_warning) |
uint | find_type (const TYPELIB *lib, const char *find, size_t length, bool part_match) |
uint | find_type2 (const TYPELIB *lib, const char *find, size_t length, const CHARSET_INFO *cs) |
uint | check_word (TYPELIB *lib, const char *val, const char *end, const char **end_of_word) |
char * | flagset_to_string (THD *thd, LEX_STRING *result, ulonglong set, const char *lib[]) |
char * | set_to_string (THD *thd, LEX_STRING *result, ulonglong set, const char *lib[]) |
char * | set_to_string (THD *thd, LEX_STRING *result, ulonglong set, const char *lib[], bool quoted) |
size_t | strconvert (const CHARSET_INFO *from_cs, const char *from, CHARSET_INFO *to_cs, char *to, size_t to_length, uint *errors) |
template<class STDSTRINGLIKE_TYPE > | |
MYSQL_LEX_CSTRING | lex_cstring_handle (const STDSTRINGLIKE_TYPE &s) |
Return a LEX_CSTRING handle to a std::string like (meaning something which has the c_str() and length() member functions). More... | |
template<class STRLIKE_TYPE > | |
STRLIKE_TYPE | casedn (const CHARSET_INFO *ci, STRLIKE_TYPE &&s) |
Lowercase a string according to charset. More... | |
template<class STRLIKE_TYPE > | |
STRLIKE_TYPE | casedn (const CHARSET_INFO *ci, const STRLIKE_TYPE &src) |
Lowercase a string according to charset. More... | |
LEX_STRING * | make_lex_string_root (MEM_ROOT *mem_root, const char *str, size_t length) |
Create a LEX_STRING in a MEM_ROOT and copy the given string into it. More... | |
bool | lex_string_strmake (MEM_ROOT *mem_root, LEX_STRING *lex_str, const char *str, size_t length) |
Copy the given string into a LEX_STRING, allocating it in the given MEM_ROOT. More... | |
bool | lex_string_strmake (MEM_ROOT *mem_root, LEX_CSTRING *lex_str, const char *str, size_t length) |
Copy the given string into a LEX_CSTRING, allocating it in the given MEM_ROOT. More... | |
template<class LEX_STRING_TYPE > | |
LEX_STRING_TYPE | LexStringDupRoot (MEM_ROOT *mem_root, LEX_STRING_TYPE s) |
Utility function for copying a LEX_STRING_TYPE (either LEX_STRING or LEX_CSTRING) onto a mem_root. More... | |
template<class LEX_STRING_TYPE > | |
LEX_STRING_TYPE | LexStringDupRootUnlessEmpty (MEM_ROOT *mem_root, LEX_STRING_TYPE s) |
Utility function for copying a LEX_STRING_TYPE (either LEX_STRING or LEX_CSTRING) onto a mem_root, but which does not allocate space for empty strings. More... | |
template<class LEX_STRING_TYPE > | |
int | strnncmp_nopads (const CHARSET_INFO &cs, LEX_STRING_TYPE &&a, LEX_STRING_TYPE &&b) |
Utility function for collating (using strnncoll) two LEX_STRING_TYPEs. More... | |
STRLIKE_TYPE casedn | ( | const CHARSET_INFO * | ci, |
const STRLIKE_TYPE & | src | ||
) |
Lowercase a string according to charset.
Overload for const T& which copies argument and forwards to T&& overload.
ci | pointer to charset for conversion |
src | string to lower-case |
modified | copy of argument |
STRLIKE_TYPE casedn | ( | const CHARSET_INFO * | ci, |
STRLIKE_TYPE && | s | ||
) |
Lowercase a string according to charset.
ci | pointer to charset for conversion |
s | string to lower-case |
modified | argument if r-value |
copy | of modified argument if lvalue (meaningless, don't use) |
ulonglong find_set | ( | const TYPELIB * | lib, |
const char * | x, | ||
size_t | length, | ||
const CHARSET_INFO * | cs, | ||
const char ** | err_pos, | ||
uint * | err_len, | ||
bool * | set_warning | ||
) |
uint find_type2 | ( | const TYPELIB * | lib, |
const char * | find, | ||
size_t | length, | ||
const CHARSET_INFO * | cs | ||
) |
char * flagset_to_string | ( | THD * | thd, |
LEX_STRING * | result, | ||
ulonglong | set, | ||
const char * | lib[] | ||
) |
MYSQL_LEX_CSTRING lex_cstring_handle | ( | const STDSTRINGLIKE_TYPE & | s | ) |
Return a LEX_CSTRING handle to a std::string like (meaning something which has the c_str() and length() member functions).
Note that the std::string-like object retains ownership of the character array, and consequently the returned LEX_CSTRING is only valid as long as the std::string-like object is valid.
s | std::string-like object |
bool lex_string_strmake | ( | MEM_ROOT * | mem_root, |
LEX_CSTRING * | lex_str, | ||
const char * | str, | ||
size_t | length | ||
) |
Copy the given string into a LEX_CSTRING, allocating it in the given MEM_ROOT.
mem_root | MEM_ROOT where to allocate the string. |
lex_str | LEX_CSTRING to fill with the copied string. |
str | string to be copied into the LEX_CSTRING. |
length | length of str, in bytes |
bool lex_string_strmake | ( | MEM_ROOT * | mem_root, |
LEX_STRING * | lex_str, | ||
const char * | str, | ||
size_t | length | ||
) |
Copy the given string into a LEX_STRING, allocating it in the given MEM_ROOT.
mem_root | MEM_ROOT where to allocate the string. |
lex_str | LEX_STRING to fill with the copied string. |
str | string to be copied into the LEX_STRING. |
length | length of str, in bytes |
|
inline |
Utility function for copying a LEX_STRING_TYPE (either LEX_STRING or LEX_CSTRING) onto a mem_root.
mem_root | Where to allocate |
s | Source string to copy. |
|
inline |
Utility function for copying a LEX_STRING_TYPE (either LEX_STRING or LEX_CSTRING) onto a mem_root, but which does not allocate space for empty strings.
If called on a zero-length string EMPTY_CSTR is returned (where str is "").
mem_root | Where to allocate |
s | Source string to copy. |
LEX_STRING * make_lex_string_root | ( | MEM_ROOT * | mem_root, |
const char * | str, | ||
size_t | length | ||
) |
Create a LEX_STRING in a MEM_ROOT and copy the given string into it.
mem_root | MEM_ROOT where to allocate the LEX_STRING. |
str | string to be copied into the LEX_STRING. |
length | length of str, in bytes |
char * set_to_string | ( | THD * | thd, |
LEX_STRING * | result, | ||
ulonglong | set, | ||
const char * | lib[] | ||
) |
char * set_to_string | ( | THD * | thd, |
LEX_STRING * | result, | ||
ulonglong | set, | ||
const char * | lib[], | ||
bool | quoted | ||
) |
size_t strconvert | ( | const CHARSET_INFO * | from_cs, |
const char * | from, | ||
CHARSET_INFO * | to_cs, | ||
char * | to, | ||
size_t | to_length, | ||
uint * | errors | ||
) |
|
inline |
Utility function for collating (using strnncoll) two LEX_STRING_TYPEs.
Saves the boiler plate and casting needed when calling the function directly.