Skip to content

Commit

Permalink
cleanup: typos, comments, whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Mar 14, 2018
1 parent bf1ca14 commit 75ac578
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
4 changes: 2 additions & 2 deletions mysql-test/r/type_time.result
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:30' and <cache>(length(TIME'10:20:30')) = 30 + rand()
# Old mode, TIMESTAMP literal, zon-zero YYYYMMDD, no propagation
# Old mode, TIMESTAMP literal, non-zero YYYYMMDD, no propagation
SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30';
a
34:20:30
Expand Down Expand Up @@ -860,7 +860,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:30' and <cache>(length(TIME'10:20:30')) = 30 + rand()
# Old mode, TIMESTAMP-alike literal, zon-zero YYYYMMDD, no propagation
# Old mode, TIMESTAMP-alike literal, non-zero YYYYMMDD, no propagation
SELECT * FROM t1 WHERE a='0000-00-01 10:20:30';
a
34:20:30
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/t/type_time.test
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=8;
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=30+RAND();

--echo # Old mode, TIMESTAMP literal, zon-zero YYYYMMDD, no propagation
--echo # Old mode, TIMESTAMP literal, non-zero YYYYMMDD, no propagation
SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30';
SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30' AND LENGTH(a)=8;
EXPLAIN EXTENDED
Expand All @@ -522,7 +522,7 @@ SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=8;
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=30+RAND();

--echo # Old mode, TIMESTAMP-alike literal, zon-zero YYYYMMDD, no propagation
--echo # Old mode, TIMESTAMP-alike literal, non-zero YYYYMMDD, no propagation
SELECT * FROM t1 WHERE a='0000-00-01 10:20:30';
SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
EXPLAIN EXTENDED
Expand Down
6 changes: 3 additions & 3 deletions sql/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@ class Item: public Value_source,
/*
Get time with automatic DATE/DATETIME to TIME conversion.
Performce a reserve operation to get_date_with_conversion().
Performes a reverse operation to get_date_with_conversion().
Suppose:
- we have a set of items (typically with the native MYSQL_TYPE_TIME type)
whose item->get_date() return TIME1 value, and
Expand Down Expand Up @@ -3842,7 +3842,7 @@ class Item_date_literal_for_invalid_dates: public Item_date_literal
Item_date_literal_for_invalid_dates::get_date()
(unlike the regular Item_date_literal::get_date())
does not check the result for NO_ZERO_IN_DATE and NO_ZER_DATE,
does not check the result for NO_ZERO_IN_DATE and NO_ZERO_DATE,
always returns success (false), and does not produce error/warning messages.
We need these _for_invalid_dates classes to be able to rewrite:
Expand Down Expand Up @@ -5588,7 +5588,7 @@ class Item_cache: public Item_basic_constant,
virtual void store(Item *item);
virtual bool cache_value()= 0;
bool basic_const_item() const
{ return MY_TEST(example && example->basic_const_item()); }
{ return example && example->basic_const_item(); }
virtual void clear() { null_value= TRUE; value_cached= FALSE; }
bool is_null() { return !has_value(); }
virtual bool is_expensive()
Expand Down
15 changes: 7 additions & 8 deletions sql/item_cmpfunc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,7 @@ void Item_bool_rowready_func2::fix_length_and_dec()
int Arg_comparator::set_compare_func(Item_func_or_sum *item, Item_result type)
{
owner= item;
func= comparator_matrix[type]
[is_owner_equal_func()];
func= comparator_matrix[type][is_owner_equal_func()];

switch (type) {
case TIME_RESULT:
Expand Down Expand Up @@ -708,7 +707,7 @@ int Arg_comparator::set_cmp_func(Item_func_or_sum *owner_arg,
@return cache item or original value.
*/

Item** Arg_comparator::cache_converted_constant(THD *thd_arg, Item **value,
Item** Arg_comparator::cache_converted_constant(THD *thd, Item **value,
Item **cache_item,
Item_result type)
{
Expand All @@ -717,12 +716,12 @@ Item** Arg_comparator::cache_converted_constant(THD *thd_arg, Item **value,
Also, get_datetime_value creates Item_cache internally.
Unless fixed, we should not do it here.
*/
if (!thd_arg->lex->is_ps_or_view_context_analysis() &&
if (!thd->lex->is_ps_or_view_context_analysis() &&
(*value)->const_item() && type != (*value)->result_type() &&
type != TIME_RESULT)
{
Item_cache *cache= Item_cache::get_cache(thd_arg, *value, type);
cache->setup(thd_arg, *value);
Item_cache *cache= Item_cache::get_cache(thd, *value, type);
cache->setup(thd, *value);
*cache_item= cache;
return cache_item;
}
Expand Down Expand Up @@ -2172,7 +2171,7 @@ void Item_func_between::fix_length_and_dec()
if (m_compare_type == TIME_RESULT)
compare_as_dates= find_date_time_item(args, 3, 0);

/* See the comment about the similar block in Item_bool_func2 */
/* See the comment for Item_func::convert_const_compared_to_int_field */
if (args[0]->real_item()->type() == FIELD_ITEM &&
!thd->lex->is_ps_or_view_context_analysis())
{
Expand Down Expand Up @@ -4286,7 +4285,7 @@ void Item_func_in::fix_length_and_dec()
values on the right can be compared as integers and adjust the
comparison type accordingly.
See the comment about the similar block in Item_bool_func2
And see the comment for Item_func::convert_const_compared_to_int_field
*/
if (args[0]->real_item()->type() == FIELD_ITEM &&
!thd->lex->is_view_context_analysis() && m_compare_type != INT_RESULT)
Expand Down
5 changes: 2 additions & 3 deletions sql/item_cmpfunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -529,14 +529,13 @@ class Item_bool_rowready_func2 :public Item_bool_func2_with_rev
clone->cmp.comparators= 0;
}
return clone;
}

}
};

/**
XOR inherits from Item_bool_func because it is not optimized yet.
Later, when XOR is optimized, it needs to inherit from
Item_cond instead. See WL#5800.
Item_cond instead. See WL#5800.
*/
class Item_func_xor :public Item_bool_func
{
Expand Down

0 comments on commit 75ac578

Please sign in to comment.