1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-31153 New methods Schema::make_item_func_* for REPLACE, SUBSTRING, TRIM

Adding virtual methods to class Schema:

  make_item_func_replace()
  make_item_func_substr()
  make_item_func_trim()

This is a non-functional preparatory change for MDEV-27744.
This commit is contained in:
Alexander Barkov
2023-04-29 07:39:38 +04:00
parent 2e74f9d281
commit ddcc9d2281
7 changed files with 170 additions and 74 deletions

View File

@ -32,6 +32,14 @@ public:
return thd->type_handler_for_datetime();
return src;
}
Item *make_item_func_replace(THD *thd,
Item *subj,
Item *find,
Item *replace) const;
Item *make_item_func_substr(THD *thd,
const Lex_substring_spec_st &spec) const;
Item *make_item_func_trim(THD *thd, const Lex_trim_st &spec) const;
};
@ -78,3 +86,56 @@ Schema *Schema::find_implied(THD *thd)
return &maxdb_schema;
return &mariadb_schema;
}
Item *Schema::make_item_func_replace(THD *thd,
Item *subj,
Item *find,
Item *replace) const
{
return new (thd->mem_root) Item_func_replace(thd, subj, find, replace);
}
Item *Schema::make_item_func_substr(THD *thd,
const Lex_substring_spec_st &spec) const
{
return spec.m_for ?
new (thd->mem_root) Item_func_substr(thd, spec.m_subject, spec.m_from,
spec.m_for) :
new (thd->mem_root) Item_func_substr(thd, spec.m_subject, spec.m_from);
}
Item *Schema::make_item_func_trim(THD *thd, const Lex_trim_st &spec) const
{
return spec.make_item_func_trim_std(thd);
}
Item *Schema_oracle::make_item_func_replace(THD *thd,
Item *subj,
Item *find,
Item *replace) const
{
return new (thd->mem_root) Item_func_replace_oracle(thd, subj, find, replace);
}
Item *Schema_oracle::make_item_func_substr(THD *thd,
const Lex_substring_spec_st &spec) const
{
return spec.m_for ?
new (thd->mem_root) Item_func_substr_oracle(thd, spec.m_subject,
spec.m_from,
spec.m_for) :
new (thd->mem_root) Item_func_substr_oracle(thd, spec.m_subject,
spec.m_from);
}
Item *Schema_oracle::make_item_func_trim(THD *thd,
const Lex_trim_st &spec) const
{
return spec.make_item_func_trim_oracle(thd);
}