cleanup: remote automatic conversion char* -> Lex_ident

considered harmful, see e.g. changes in check_period_fields()
This commit is contained in:
Sergei Golubchik 2025-04-21 15:03:01 +02:00
parent 588f7a5af7
commit 63a69ab936
6 changed files with 12 additions and 24 deletions

View File

@ -8253,16 +8253,6 @@ int del_global_index_stat(THD *thd, TABLE* table, KEY* key_info)
VERSIONING functions
******************************************************************************/
bool Vers_parse_info::is_start(const char *name) const
{
DBUG_ASSERT(name);
return as_row.start && as_row.start.streq(name);
}
bool Vers_parse_info::is_end(const char *name) const
{
DBUG_ASSERT(name);
return as_row.end && as_row.end.streq(name);
}
bool Vers_parse_info::is_start(const Create_field &f) const
{
return f.flags & VERS_ROW_START;
@ -8317,8 +8307,8 @@ bool Vers_parse_info::create_sys_field(THD *thd, const char *field_name,
return false;
}
const Lex_ident Vers_parse_info::default_start= "row_start";
const Lex_ident Vers_parse_info::default_end= "row_end";
const Lex_ident Vers_parse_info::default_start= { STRING_WITH_LEN("row_start")};
const Lex_ident Vers_parse_info::default_end= { STRING_WITH_LEN("row_end")};
bool Vers_parse_info::fix_implicit(THD *thd, Alter_info *alter_info)
{
@ -8577,7 +8567,7 @@ bool Vers_parse_info::fix_alter_info(THD *thd, Alter_info *alter_info,
if (alter_info->flags & ALTER_ADD_SYSTEM_VERSIONING)
{
if (check_sys_fields(table_name, share->db, alter_info))
if (check_sys_fields(share->table_name, share->db, alter_info))
return true;
}
@ -8883,8 +8873,8 @@ bool Table_scope_and_contents_source_st::check_period_fields(
}
}
bool res= period_info.check_field(row_start, period.start.str)
|| period_info.check_field(row_end, period.end.str);
bool res= period_info.check_field(row_start, period.start)
|| period_info.check_field(row_end, period.end);
if (res)
return true;

View File

@ -2117,8 +2117,6 @@ struct Vers_parse_info: public Table_period_info
}
protected:
bool is_start(const char *name) const;
bool is_end(const char *name) const;
bool is_start(const Create_field &f) const;
bool is_end(const Create_field &f) const;
bool fix_implicit(THD *thd, Alter_info *alter_info);

View File

@ -110,7 +110,7 @@ class Lex_cstring : public LEX_CSTRING
class Lex_cstring_strlen: public Lex_cstring
{
public:
Lex_cstring_strlen(const char *from)
explicit Lex_cstring_strlen(const char *from)
:Lex_cstring(from, from ? strlen(from) : 0)
{ }
};

View File

@ -6235,7 +6235,7 @@ drop_create_field:
}
else if (drop->type == Alter_drop::PERIOD)
{
if (table->s->period.name.streq(drop->name))
if (table->s->period.name.streq(Lex_ident(drop->name)))
remove_drop= FALSE;
}
else /* Alter_drop::KEY and Alter_drop::FOREIGN_KEY */
@ -9227,7 +9227,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
for (bool found= false; !found && (drop= drop_it++); )
{
found= drop->type == Alter_drop::PERIOD &&
table->s->period.name.streq(drop->name);
table->s->period.name.streq(Lex_ident(drop->name));
}
if (drop)
@ -9270,7 +9270,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
}
}
if (share->period.constr_name.streq(check->name.str))
if (share->period.constr_name.streq(check->name))
{
if (!drop_period && !keep)
{

View File

@ -2192,7 +2192,7 @@ struct vers_select_conds_t
void init(vers_system_time_t _type,
Vers_history_point _start= Vers_history_point(),
Vers_history_point _end= Vers_history_point(),
Lex_ident _name= "SYSTEM_TIME")
Lex_ident _name= { STRING_WITH_LEN("SYSTEM_TIME") })
{
type= _type;
orig_type= _type;
@ -2207,7 +2207,7 @@ struct vers_select_conds_t
void set_all()
{
type= SYSTEM_TIME_ALL;
name= "SYSTEM_TIME";
name= { STRING_WITH_LEN("SYSTEM_TIME") };
}
void print(String *str, enum_query_type query_type) const;

View File

@ -62,7 +62,7 @@ public:
{ }
Lex_cstring_with_compare(const LEX_CSTRING src) : Lex_cstring(src.str, src.length)
{ }
Lex_cstring_with_compare(const char *_str) : Lex_cstring(_str, strlen(_str))
explicit Lex_cstring_with_compare(const char *_str) : Lex_cstring(_str, strlen(_str))
{ }
bool streq(const Lex_cstring_with_compare& b) const
{