Commit 75ac5789 authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: typos, comments, whitespace

parent bf1ca14f
...@@ -822,7 +822,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -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 1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings: 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() 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'; SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30';
a a
34:20:30 34:20:30
...@@ -860,7 +860,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -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 1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings: 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() 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'; SELECT * FROM t1 WHERE a='0000-00-01 10:20:30';
a a
34:20:30 34:20:30
......
...@@ -506,7 +506,7 @@ SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=8; ...@@ -506,7 +506,7 @@ SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=8;
EXPLAIN EXTENDED EXPLAIN EXTENDED
SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=30+RAND(); 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';
SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30' AND LENGTH(a)=8; SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30' AND LENGTH(a)=8;
EXPLAIN EXTENDED EXPLAIN EXTENDED
...@@ -522,7 +522,7 @@ SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=8; ...@@ -522,7 +522,7 @@ SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=8;
EXPLAIN EXTENDED EXPLAIN EXTENDED
SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=30+RAND(); 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';
SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8; SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
EXPLAIN EXTENDED EXPLAIN EXTENDED
......
...@@ -1365,7 +1365,7 @@ class Item: public Value_source, ...@@ -1365,7 +1365,7 @@ class Item: public Value_source,
/* /*
Get time with automatic DATE/DATETIME to TIME conversion. 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: Suppose:
- we have a set of items (typically with the native MYSQL_TYPE_TIME type) - we have a set of items (typically with the native MYSQL_TYPE_TIME type)
whose item->get_date() return TIME1 value, and whose item->get_date() return TIME1 value, and
...@@ -3842,7 +3842,7 @@ class Item_date_literal_for_invalid_dates: public Item_date_literal ...@@ -3842,7 +3842,7 @@ class Item_date_literal_for_invalid_dates: public Item_date_literal
Item_date_literal_for_invalid_dates::get_date() Item_date_literal_for_invalid_dates::get_date()
(unlike the regular Item_date_literal::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. always returns success (false), and does not produce error/warning messages.
We need these _for_invalid_dates classes to be able to rewrite: We need these _for_invalid_dates classes to be able to rewrite:
...@@ -5588,7 +5588,7 @@ class Item_cache: public Item_basic_constant, ...@@ -5588,7 +5588,7 @@ class Item_cache: public Item_basic_constant,
virtual void store(Item *item); virtual void store(Item *item);
virtual bool cache_value()= 0; virtual bool cache_value()= 0;
bool basic_const_item() const 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; } virtual void clear() { null_value= TRUE; value_cached= FALSE; }
bool is_null() { return !has_value(); } bool is_null() { return !has_value(); }
virtual bool is_expensive() virtual bool is_expensive()
......
...@@ -525,8 +525,7 @@ void Item_bool_rowready_func2::fix_length_and_dec() ...@@ -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) int Arg_comparator::set_compare_func(Item_func_or_sum *item, Item_result type)
{ {
owner= item; owner= item;
func= comparator_matrix[type] func= comparator_matrix[type][is_owner_equal_func()];
[is_owner_equal_func()];
switch (type) { switch (type) {
case TIME_RESULT: case TIME_RESULT:
...@@ -708,7 +707,7 @@ int Arg_comparator::set_cmp_func(Item_func_or_sum *owner_arg, ...@@ -708,7 +707,7 @@ int Arg_comparator::set_cmp_func(Item_func_or_sum *owner_arg,
@return cache item or original value. @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 **cache_item,
Item_result type) Item_result type)
{ {
...@@ -717,12 +716,12 @@ Item** Arg_comparator::cache_converted_constant(THD *thd_arg, Item **value, ...@@ -717,12 +716,12 @@ Item** Arg_comparator::cache_converted_constant(THD *thd_arg, Item **value,
Also, get_datetime_value creates Item_cache internally. Also, get_datetime_value creates Item_cache internally.
Unless fixed, we should not do it here. 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() && (*value)->const_item() && type != (*value)->result_type() &&
type != TIME_RESULT) type != TIME_RESULT)
{ {
Item_cache *cache= Item_cache::get_cache(thd_arg, *value, type); Item_cache *cache= Item_cache::get_cache(thd, *value, type);
cache->setup(thd_arg, *value); cache->setup(thd, *value);
*cache_item= cache; *cache_item= cache;
return cache_item; return cache_item;
} }
...@@ -2172,7 +2171,7 @@ void Item_func_between::fix_length_and_dec() ...@@ -2172,7 +2171,7 @@ void Item_func_between::fix_length_and_dec()
if (m_compare_type == TIME_RESULT) if (m_compare_type == TIME_RESULT)
compare_as_dates= find_date_time_item(args, 3, 0); 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 && if (args[0]->real_item()->type() == FIELD_ITEM &&
!thd->lex->is_ps_or_view_context_analysis()) !thd->lex->is_ps_or_view_context_analysis())
{ {
...@@ -4286,7 +4285,7 @@ void Item_func_in::fix_length_and_dec() ...@@ -4286,7 +4285,7 @@ void Item_func_in::fix_length_and_dec()
values on the right can be compared as integers and adjust the values on the right can be compared as integers and adjust the
comparison type accordingly. 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 && if (args[0]->real_item()->type() == FIELD_ITEM &&
!thd->lex->is_view_context_analysis() && m_compare_type != INT_RESULT) !thd->lex->is_view_context_analysis() && m_compare_type != INT_RESULT)
......
...@@ -529,14 +529,13 @@ class Item_bool_rowready_func2 :public Item_bool_func2_with_rev ...@@ -529,14 +529,13 @@ class Item_bool_rowready_func2 :public Item_bool_func2_with_rev
clone->cmp.comparators= 0; clone->cmp.comparators= 0;
} }
return clone; return clone;
} }
}; };
/** /**
XOR inherits from Item_bool_func because it is not optimized yet. XOR inherits from Item_bool_func because it is not optimized yet.
Later, when XOR is optimized, it needs to inherit from 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 class Item_func_xor :public Item_bool_func
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment