[MDEV-31972] Change parameter of make_sp_name*() from LEX_CSTRING to Lex_ident_sys_st Created: 2023-08-21  Updated: 2023-09-17  Resolved: 2023-08-21

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Fix Version/s: 11.3.0

Type: Task Priority: Critical
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-27490 Allow full utf8mb4 for identifiers Stalled
blocks MDEV-31531 Remove my_casedn_str() and my_caseup_... In Testing
blocks MDEV-31606 Refactor check_db_name() to get a con... Closed

 Description   

In order to implement MDEV-31606 and MDEV-27490 easier let's change a few LEX methods as follows:

-  sp_name *make_sp_name(THD *thd, const LEX_CSTRING *name);
-  sp_name *make_sp_name(THD *thd, const LEX_CSTRING *name1,
-                                  const LEX_CSTRING *name2);
-  sp_name *make_sp_name_package_routine(THD *thd, const LEX_CSTRING *name);
+  sp_name *make_sp_name(THD *thd, const Lex_ident_sys_st &name);
+  sp_name *make_sp_name(THD *thd, const Lex_ident_sys_st &name1,
+                                  const Lex_ident_sys_st &name2);
+  sp_name *make_sp_name_package_routine(THD *thd,
+                                        const Lex_ident_sys_st &name);

Changing LEX_CSTRING to Lex_ident_sys_st makes the code inside these methods clear, because Lex_ident_sys_st additionally guarantees that the value comes from the "ident" rule from sql_yacc.yy, so:

  • Its LEX_CSTRING::str is not NULL (sql_yacc.yy would abort otherwise)
  • Its LEX_CSTRING::str is 0-terminated
  • Its a valid utf8 string
  • The string pointed by LEX_CSTRING::str was created on THD::mem_root

Also, let's change "pass by pointer" to "pass by reference", as these parameters can never be NULL - they are Bison stack variables.


Generated at Thu Feb 08 10:27:51 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.