maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #12032
Re: c91ec05e01b: MDEV-20865 Store foreign key info in TABLE_SHARE
Hi Sergei!
On Wed, Dec 4, 2019 at 10:10 PM Sergei Golubchik <serg@xxxxxxxxxxx> wrote:
> ...
> > + Lex_cstring *strdup_root(MEM_ROOT &mem_root)
>
> The way you use it, it looks like you really need a constructor, not
> a strdup.
>
On second thought, it can't be a constructor because it can fail with
allocation error.
But it's better to be from the other side:
bool Lex_cstring::strdup(MEM_ROOT *mem_root, const Lex_cstring &src)
{
// allocate and deep-copy from src to this
}
I'd really like to use such utility methods instead of C variants like
thd_make_lex_string(). For plugins we can have strdup() method accepting
THD * and compiled inside server (non-inline):
bool Lex_cstring::strdup(THD *thd, const Lex_cstring &src)
{
strdup(thd->mem_root, src);
}
We better go away from this C service layer of thd_*() functions between
server and plugins and use class methods instead. We can't use THD directly
though, because we don't want it compiled in plugins. So we compile
non-inline methods in server that are used in plugin.
--
All the best,
Aleksey Midenkov
@midenok
Follow ups
References