Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
Item_func_format::print() was redundant
and other changes
  • Loading branch information
vuvova committed Sep 18, 2017
1 parent 3af191b commit 8b1f145
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 31 deletions.
4 changes: 2 additions & 2 deletions cmake/submodules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ IF(GIT_EXECUTABLE AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
IF(git_config_get_result EQUAL 128 OR cmake_update_submodules MATCHES no)
SET(update_result 0)
ELSEIF (cmake_update_submodules MATCHES force)
MESSAGE("-- Updating submodules (forced)")
MESSAGE(STATUS "Updating submodules (forced)")
EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --force
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE update_result)
Expand All @@ -16,7 +16,7 @@ IF(GIT_EXECUTABLE AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE update_result)
ELSE()
MESSAGE("-- Updating submodules")
MESSAGE(STATUS "Updating submodules")
EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE update_result)
Expand Down
18 changes: 17 additions & 1 deletion mysql-test/r/locale.result
Original file line number Diff line number Diff line change
Expand Up @@ -223,5 +223,21 @@ SELECT * FROM non_existent;
ERROR 42S02: Table 'test.non_existent' doesn't exist
SET lc_time_names=@old_50915_lc_time_names;
#
# End of 5.6 tests
# End of 10.0 tests
#
#
# End of 10.1 tests
#
create view v1 as select
format(123456789,2) as b,
format(123456789,2,'rm_CH') as b1;
select * from v1;
b b1
123,456,789.00 123'456'789,00
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select format(123456789,2) AS `b`,format(123456789,2,'rm_CH') AS `b1` utf8 utf8_general_ci
drop view v1;
#
# End of 10.2 tests
#
17 changes: 16 additions & 1 deletion mysql-test/t/locale.test
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,22 @@ SELECT * FROM non_existent;

SET lc_time_names=@old_50915_lc_time_names;

--echo #
--echo # End of 10.0 tests
--echo #

--echo #
--echo # End of 10.1 tests
--echo #

# Item::print
create view v1 as select
format(123456789,2) as b,
format(123456789,2,'rm_CH') as b1;
select * from v1;
show create view v1;
drop view v1;

--echo #
--echo # End of 5.6 tests
--echo # End of 10.2 tests
--echo #
14 changes: 0 additions & 14 deletions sql/item_strfunc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2707,20 +2707,6 @@ String *Item_func_format::val_str_ascii(String *str)
}


void Item_func_format::print(String *str, enum_query_type query_type)
{
str->append(STRING_WITH_LEN("format("));
args[0]->print(str, query_type);
str->append(',');
args[1]->print(str, query_type);
if(arg_count > 2)
{
str->append(',');
args[2]->print(str,query_type);
}
str->append(')');
}

void Item_func_elt::fix_length_and_dec()
{
uint32 char_length= 0;
Expand Down
18 changes: 8 additions & 10 deletions sql/item_strfunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class Item_str_ascii_func :public Item_str_func
{
return val_str_from_val_str_ascii(str, &ascii_buf);
}
virtual String *val_str_ascii(String *)= 0;
String *val_str_ascii(String *)= 0;
};


Expand Down Expand Up @@ -490,7 +490,7 @@ class Item_func_trim :public Item_str_func
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "trim"; }
virtual void print(String *str, enum_query_type query_type);
void print(String *str, enum_query_type query_type);
virtual const char *mode_name() const { return "both"; }
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_trim>(thd, mem_root, this); }
Expand Down Expand Up @@ -853,7 +853,6 @@ class Item_func_format :public Item_str_ascii_func
String *val_str_ascii(String *);
void fix_length_and_dec();
const char *func_name() const { return "format"; }
virtual void print(String *str, enum_query_type query_type);
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_format>(thd, mem_root, this); }
};
Expand Down Expand Up @@ -914,7 +913,6 @@ class Item_func_binlog_gtid_pos :public Item_str_func
const char *func_name() const { return "binlog_gtid_pos"; }
bool check_vcol_func_processor(void *arg)
{

return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
Expand Down Expand Up @@ -1070,7 +1068,7 @@ class Item_func_binary :public Item_str_func
collation.set(&my_charset_bin);
max_length=args[0]->max_length;
}
virtual void print(String *str, enum_query_type query_type);
void print(String *str, enum_query_type query_type);
const char *func_name() const { return "cast_as_binary"; }
bool need_parentheses_in_default() { return true; }
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
Expand Down Expand Up @@ -1214,7 +1212,7 @@ class Item_func_conv_charset :public Item_str_func
}
void fix_length_and_dec();
const char *func_name() const { return "convert"; }
virtual void print(String *str, enum_query_type query_type);
void print(String *str, enum_query_type query_type);
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_conv_charset>(thd, mem_root, this); }
};
Expand All @@ -1230,7 +1228,7 @@ class Item_func_set_collation :public Item_str_func
const char *func_name() const { return "collate"; }
enum precedence precedence() const { return COLLATE_PRECEDENCE; }
enum Functype functype() const { return COLLATE_FUNC; }
virtual void print(String *str, enum_query_type query_type);
void print(String *str, enum_query_type query_type);
Item_field *field_for_view_update()
{
/* this function is transparent for view updating */
Expand Down Expand Up @@ -1412,8 +1410,8 @@ class Item_func_dyncol_create: public Item_str_func
void fix_length_and_dec();
const char *func_name() const{ return "column_create"; }
String *val_str(String *);
virtual void print(String *str, enum_query_type query_type);
virtual enum Functype functype() const { return DYNCOL_FUNC; }
void print(String *str, enum_query_type query_type);
enum Functype functype() const { return DYNCOL_FUNC; }
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_dyncol_create>(thd, mem_root, this); }
};
Expand All @@ -1427,7 +1425,7 @@ class Item_func_dyncol_add: public Item_func_dyncol_create
{}
const char *func_name() const{ return "column_add"; }
String *val_str(String *);
virtual void print(String *str, enum_query_type query_type);
void print(String *str, enum_query_type query_type);
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_dyncol_add>(thd, mem_root, this); }
};
Expand Down
4 changes: 1 addition & 3 deletions sql/item_timefunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ class Item_func_monthname :public Item_str_func
}
bool check_vcol_func_processor(void *arg)
{

return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC);
}
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
Expand Down Expand Up @@ -693,8 +692,7 @@ class Item_func_curdate :public Item_datefunc
virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)=0;
bool check_vcol_func_processor(void *arg)
{
return mark_unsupported_function(func_name(), "()", arg,
VCOL_TIME_FUNC);
return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC);
}
};

Expand Down

0 comments on commit 8b1f145

Please sign in to comment.