mirror of
https://github.com/MariaDB/server.git
synced 2026-04-29 19:55:32 +02:00
MDEV-31606 Refactor check_db_name() to get a const argument
Problem:
Under terms of MDEV-27490, we'll update Unicode version used
to compare identifiers to 14.0.0. Unlike in the old Unicode version,
in the new version a string can grow during lower-case. We cannot
perform check_db_name() inplace any more.
Change summary:
- Allocate memory to store lower-cased identifiers in memory root
- Removing check_db_name() performing both in-place lower-casing and validation
at the same time. Splitting it into two separate stages:
* creating a memory-root lower-cased copy of an identifier
(using new MEM_ROOT functions and Query_arena wrapper methods)
* performing validation on a constant string
(using Lex_ident_fs methods)
Implementation details:
- Adding a mysys helper function to allocate lower-cased strings on MEM_ROOT:
lex_string_casedn_root()
and a Query_arena wrappers for it:
make_ident_casedn()
make_ident_opt_casedn()
- Adding a Query_arena method to perform both MEM_ROOT lower-casing and
database name validation at the same time:
to_ident_db_internal_with_error()
This method is very close to the old (pre-11.3) check_db_name(),
but performs lower-casing to a newly allocated MEM_ROOT
memory (instead of performing lower-casing the original string in-place).
- Adding a Table_ident method which additionally handles derived table names:
to_ident_db_internal_with_error()
- Removing the old check_db_name()
This commit is contained in:
parent
e987b9350c
commit
f5aae71661
15 changed files with 244 additions and 172 deletions
|
|
@ -10409,7 +10409,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
|
|||
till this point for the alter operation.
|
||||
*/
|
||||
if ((alter_info->flags & ALTER_ADD_FOREIGN_KEY) &&
|
||||
check_fk_parent_table_access(thd, create_info, alter_info, new_db->str))
|
||||
check_fk_parent_table_access(thd, create_info, alter_info, *new_db))
|
||||
DBUG_RETURN(true);
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue