Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
Description
This task is a part of MDEV-31606. It's to remove the old style check_db_name() from prepare_db_action().
Let's do the following:
- Add a new class Lex_ident_db, to store normalized database names: lower-cased if lower-case-table-name says so, and checked to be a valid database name using Lex_ident_fs::check_db_name(), with asserts in the contructor:
class Lex_ident_db: public Lex_ident_fs
{
public:
Lex_ident_db()
:Lex_ident_fs(NULL, 0)
{ }
Lex_ident_db(const char *str, size_t length)
:Lex_ident_fs(str, length)
{
DBUG_SLOW_ASSERT(ok_for_lower_case_names());
DBUG_SLOW_ASSERT(!check_db_name());
}
};
- Add the following method to class DBNameBuffer:
Lex_ident_db to_lex_ident_db_with_error() const
{
LEX_CSTRING tmp= to_lex_cstring();
if (Lex_ident_fs(tmp).check_db_name_with_error())
return Lex_ident_db();
return Lex_ident_db(tmp.str, tmp.length);
}
- Remove check_db_name() from prepare_db_action()
- Change the "db" parameter to prepare_db_action() from LEX_CSTRING to Lex_ident_db
- Move creation of Lex_ident_db one level upper, in the switch cases handling SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB_UPGRADE, SQLCOM_ALTER_DB, with help of the class DBNameBuffer.
- Change the "db" parameter from LEX_CSTRNG to Lex_ident_db in the following function:
int mysql_create_db(THD *thd, const Lex_ident_db &db, DDL_options_st options,
const Schema_specification_st *create);
bool mysql_alter_db(THD *thd, const Lex_ident_db &db,
const Schema_specification_st *create);
bool mysql_rm_db(THD *thd, const Lex_ident_db &db, bool if_exists);
bool mysql_upgrade_db(THD *thd, const Lex_ident_db &old_db);
so these functions know that the database was already normalized and validated.
Attachments
Issue Links
- blocks
-
MDEV-31531 Remove my_casedn_str() and my_caseup_str()
- Closed
-
MDEV-31606 Refactor check_db_name() to get a const argument
- Closed
- causes
-
MDEV-32026 lowercase_table2.test failures in 11.3
- Closed