summaryrefslogtreecommitdiffstats
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-01 18:15:00 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-01 18:15:00 +0000
commita2a2e32c02643a0cec111511220227703fda1cd5 (patch)
tree69cc2b631234c2a8e026b9cd4d72676c61c594df /sql/item_func.cc
parentReleasing progress-linux version 1:10.11.8-1~progress7.99u1. (diff)
downloadmariadb-a2a2e32c02643a0cec111511220227703fda1cd5.tar.xz
mariadb-a2a2e32c02643a0cec111511220227703fda1cd5.zip
Merging upstream version 1:11.4.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc64
1 files changed, 17 insertions, 47 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 9743c9a2..4cd4b3b7 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -290,7 +290,6 @@ bool Item_func::check_argument_types_scalar(uint start, uint end) const
return false;
}
-
/*
Resolve references to table column for a function and its argument
@@ -384,6 +383,7 @@ Item_func::fix_fields(THD *thd, Item **ref)
return TRUE;
}
base_flags|= item_base_t::FIXED;
+
return FALSE;
}
@@ -7095,14 +7095,24 @@ longlong Item_func_nextval::val_int()
}
+bool Item_func_nextval::print_table_list_identifier(THD *thd, String *to) const
+{
+ if (table_list->db.str && table_list->db.str[0])
+ {
+ if (append_identifier_opt_casedn(thd, to, table_list->db,
+ lower_case_table_names) ||
+ to->append('.'))
+ return true;
+ }
+ return append_identifier_opt_casedn(thd, to, table_list->table_name,
+ lower_case_table_names);
+}
+
+
/* Print for nextval and lastval */
void Item_func_nextval::print(String *str, enum_query_type query_type)
{
- char d_name_buff[MAX_ALIAS_NAME], t_name_buff[MAX_ALIAS_NAME];
- LEX_CSTRING d_name= table_list->db;
- LEX_CSTRING t_name= table_list->table_name;
- bool use_db_name= d_name.str && d_name.str[0];
THD *thd= current_thd; // Don't trust 'table'
str->append(func_name_cstring());
@@ -7112,26 +7122,8 @@ void Item_func_nextval::print(String *str, enum_query_type query_type)
for next_val we assume that table_list has been updated to contain
the current db.
*/
+ print_table_list_identifier(thd, str);
- if (lower_case_table_names > 0)
- {
- strmake(t_name_buff, t_name.str, MAX_ALIAS_NAME-1);
- t_name.length= my_casedn_str(files_charset_info, t_name_buff);
- t_name.str= t_name_buff;
- if (use_db_name)
- {
- strmake(d_name_buff, d_name.str, MAX_ALIAS_NAME-1);
- d_name.length= my_casedn_str(files_charset_info, d_name_buff);
- d_name.str= d_name_buff;
- }
- }
-
- if (use_db_name)
- {
- append_identifier(thd, str, &d_name);
- str->append('.');
- }
- append_identifier(thd, str, &t_name);
str->append(')');
}
@@ -7223,10 +7215,6 @@ longlong Item_func_setval::val_int()
void Item_func_setval::print(String *str, enum_query_type query_type)
{
- char d_name_buff[MAX_ALIAS_NAME], t_name_buff[MAX_ALIAS_NAME];
- LEX_CSTRING d_name= table_list->db;
- LEX_CSTRING t_name= table_list->table_name;
- bool use_db_name= d_name.str && d_name.str[0];
THD *thd= current_thd; // Don't trust 'table'
str->append(func_name_cstring());
@@ -7236,26 +7224,8 @@ void Item_func_setval::print(String *str, enum_query_type query_type)
for next_val we assume that table_list has been updated to contain
the current db.
*/
+ print_table_list_identifier(thd, str);
- if (lower_case_table_names > 0)
- {
- strmake(t_name_buff, t_name.str, MAX_ALIAS_NAME-1);
- t_name.length= my_casedn_str(files_charset_info, t_name_buff);
- t_name.str= t_name_buff;
- if (use_db_name)
- {
- strmake(d_name_buff, d_name.str, MAX_ALIAS_NAME-1);
- d_name.length= my_casedn_str(files_charset_info, d_name_buff);
- d_name.str= d_name_buff;
- }
- }
-
- if (use_db_name)
- {
- append_identifier(thd, str, &d_name);
- str->append('.');
- }
- append_identifier(thd, str, &t_name);
str->append(',');
str->append_longlong(nextval);
str->append(',');