Skip to content

Commit

Permalink
Cleanup: Adding "const" to the member Spvar_definition::m_column_type…
Browse files Browse the repository at this point in the history
…_ref

and to related methods and their parameters:
- The return value of Spvar_definition::m_column_type_ref()
- The parameter of Spvar_definition::set_column_type_ref()
- The method Qualified_column_ident::resolve_type_ref()
- The parameter of LEX::sp_variable_declarations_column_type_finalize()
  • Loading branch information
abarkov committed Nov 10, 2023
1 parent b8f9f79 commit b0379ea
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
8 changes: 4 additions & 4 deletions sql/field.h
Original file line number Diff line number Diff line change
Expand Up @@ -5585,8 +5585,8 @@ class Row_definition_list: public List<class Spvar_definition>
*/
class Spvar_definition: public Column_definition
{
Qualified_column_ident *m_column_type_ref; // for %TYPE
Table_ident *m_table_rowtype_ref; // for table%ROWTYPE
const Qualified_column_ident *m_column_type_ref; // for %TYPE
Table_ident *m_table_rowtype_ref; // for table%ROWTYPE
bool m_cursor_rowtype_ref; // for cursor%ROWTYPE
uint m_cursor_rowtype_offset; // for cursor%ROWTYPE
Row_definition_list *m_row_field_definitions; // for ROW
Expand Down Expand Up @@ -5619,11 +5619,11 @@ class Spvar_definition: public Column_definition
!is_table_rowtype_ref() &&
!is_cursor_rowtype_ref();
}
Qualified_column_ident *column_type_ref() const
const Qualified_column_ident *column_type_ref() const
{
return m_column_type_ref;
}
void set_column_type_ref(Qualified_column_ident *ref)
void set_column_type_ref(const Qualified_column_ident *ref)
{
m_column_type_ref= ref;
}
Expand Down
3 changes: 2 additions & 1 deletion sql/sp_rcontext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ check_column_grant_for_type_ref(THD *thd, TABLE_LIST *table_list,
/**
This method implementation is very close to fill_schema_table_by_open().
*/
bool Qualified_column_ident::resolve_type_ref(THD *thd, Column_definition *def)
bool Qualified_column_ident::resolve_type_ref(THD *thd,
Column_definition *def) const
{
Open_tables_backup open_tables_state_backup;
thd->reset_n_backup_open_tables_state(&open_tables_state_backup);
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -7142,7 +7142,7 @@ class Qualified_column_ident: public Table_ident
:Table_ident(thd, db, table, false),
m_column(*column)
{ }
bool resolve_type_ref(THD *thd, Column_definition *def);
bool resolve_type_ref(THD *thd, Column_definition *def) const;
bool append_to(THD *thd, String *to) const;
};

Expand Down
8 changes: 4 additions & 4 deletions sql/sql_lex.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6715,9 +6715,9 @@ LEX::sp_variable_declarations_with_ref_finalize(THD *thd, int nvars,

bool
LEX::sp_variable_declarations_column_type_finalize(THD *thd, int nvars,
Qualified_column_ident *ref,
Item *def,
const LEX_CSTRING &expr_str)
const Qualified_column_ident *ref,
Item *def,
const LEX_CSTRING &expr_str)
{
for (uint i= 0 ; i < (uint) nvars; i++)
{
Expand Down Expand Up @@ -6757,7 +6757,7 @@ LEX::sp_variable_declarations_vartype_finalize(THD *thd, int nvars,

if (t->field_def.is_column_type_ref())
{
Qualified_column_ident *tmp= t->field_def.column_type_ref();
const Qualified_column_ident *tmp= t->field_def.column_type_ref();
return sp_variable_declarations_column_type_finalize(thd, nvars, tmp,
default_value,
expr_str);
Expand Down
6 changes: 3 additions & 3 deletions sql/sql_lex.h
Original file line number Diff line number Diff line change
Expand Up @@ -3972,9 +3972,9 @@ struct LEX: public Query_tables_list
Item *def,
const LEX_CSTRING &expr_str);
bool sp_variable_declarations_column_type_finalize(THD *thd, int nvars,
Qualified_column_ident *ref,
Item *def,
const LEX_CSTRING &expr_str);
const Qualified_column_ident *ref,
Item *def,
const LEX_CSTRING &expr_str);
bool sp_variable_declarations_vartype_finalize(THD *thd, int nvars,
const LEX_CSTRING &name,
Item *def,
Expand Down

0 comments on commit b0379ea

Please sign in to comment.