Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
Description
Let's add automatic conversion operator from LEX_STRING to LEX_CSTRING.
struct st_mysql_lex_string |
{
|
char *str; |
size_t length; |
#ifdef __cplusplus
|
// Allow automatic cast from LEX_STRING to LEX_CSTRING in c++. |
operator struct st_mysql_const_lex_string() const |
{
|
return {str, length}; |
}
|
#endif |
This will help to remove some duplicate functions/methods accepting LEX_CSTRING and LEX_STRING and to avoid adding duplicate functions/methods in the future.
Duplicate methods:
Lex_cstring_with_compare(const LEX_STRING src) : |
Lex_cstring(src.str, src.length)
|
{ }
|
Lex_cstring_with_compare(const LEX_CSTRING src) : Lex_cstring(src.str, src.length) |
{ }
|
Storage_engine_name(const LEX_CSTRING &name) |
:m_storage_engine_name(name)
|
{ }
|
Storage_engine_name(const LEX_STRING &name) |
{
|
m_storage_engine_name.str= name.str;
|
m_storage_engine_name.length= name.length;
|
}
|
// Append with optional character set conversion from ASCII (e.g. to UCS2) |
bool append(const LEX_STRING *ls) |
{
|
DBUG_ASSERT(ls->length < UINT_MAX32 &&
|
((ls->length == 0 && !ls->str) ||
|
ls->length == strlen(ls->str))); |
return append(ls->str, (uint32) ls->length); |
}
|
bool append(const LEX_CSTRING *ls) |
{
|
DBUG_ASSERT(ls->length < UINT_MAX32 &&
|
((ls->length == 0 && !ls->str) ||
|
ls->length == strlen(ls->str))); |
return append(ls->str, (uint32) ls->length); |
}
|
The version with LEX_STRING should be removed.
Attachments
Issue Links
- blocks
-
MDEV-31531 Remove my_casedn_str() and my_caseup_str()
- Closed
-
MDEV-31606 Refactor check_db_name() to get a const argument
- Closed