mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03: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:
@@ -50,7 +50,7 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables,
|
||||
bool check_fk_parent_table_access(THD *thd,
|
||||
HA_CREATE_INFO *create_info,
|
||||
Alter_info *alter_info,
|
||||
const char* create_db);
|
||||
const LEX_CSTRING &create_db);
|
||||
|
||||
bool parse_sql(THD *thd, Parser_state *parser_state,
|
||||
Object_creation_ctx *creation_ctx, bool do_pfs_digest=false);
|
||||
|
Reference in New Issue
Block a user