Commit 71e48593 authored by monty@mysql.com's avatar monty@mysql.com

After merge fixes

parent 38d1a424
...@@ -635,6 +635,6 @@ DROP TABLE t1; ...@@ -635,6 +635,6 @@ DROP TABLE t1;
CREATE TABLE t1 (Field1 int(10) unsigned default '0'); CREATE TABLE t1 (Field1 int(10) unsigned default '0');
INSERT INTO t1 VALUES ('-1'); INSERT INTO t1 VALUES ('-1');
Warnings: Warnings:
Warning 1265 Data truncated for column 'Field1' at row 1 Warning 1264 Out of range value adjusted for column 'Field1' at row 1
DROP TABLE t1; DROP TABLE t1;
SET NAMES latin1; SET NAMES latin1;
...@@ -2452,7 +2452,7 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs) ...@@ -2452,7 +2452,7 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
from+= tmp; from+= tmp;
end= (char*) from+len; end= (char*) from+len;
tmp= my_strtoll10(from, &end, &error); tmp= cs->cset->my_strtoll10(cs, from, &end, &error);
if (error != MY_ERRNO_EDOM) if (error != MY_ERRNO_EDOM)
{ {
......
...@@ -273,8 +273,7 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type) ...@@ -273,8 +273,7 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type)
owner= item; owner= item;
func= comparator_matrix[type] func= comparator_matrix[type]
[test(owner->functype() == Item_func::EQUAL_FUNC)]; [test(owner->functype() == Item_func::EQUAL_FUNC)];
switch(type) switch(type) {
{
case ROW_RESULT: case ROW_RESULT:
{ {
uint n= (*a)->cols(); uint n= (*a)->cols();
...@@ -877,10 +876,20 @@ void Item_func_interval::fix_length_and_dec() ...@@ -877,10 +876,20 @@ void Item_func_interval::fix_length_and_dec()
/* /*
return -1 if null value, Execute Item_func_interval()
0 if lower than lowest
1 - arg_count-1 if between args[n] and args[n+1] SYNOPSIS
arg_count if higher than biggest argument Item_func_interval::val_int()
NOTES
If we are doing a decimal comparison, we are
evaluating the first item twice.
RETURN
-1 if null value,
0 if lower than lowest
1 - arg_count-1 if between args[n] and args[n+1]
arg_count if higher than biggest argument
*/ */
longlong Item_func_interval::val_int() longlong Item_func_interval::val_int()
...@@ -888,11 +897,10 @@ longlong Item_func_interval::val_int() ...@@ -888,11 +897,10 @@ longlong Item_func_interval::val_int()
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
double value= row->el(0)->val_real(); double value= row->el(0)->val_real();
my_decimal dec_buf, *dec= NULL; my_decimal dec_buf, *dec= NULL;
uint i;
if (use_decimal_comparison) if (use_decimal_comparison)
{
dec= row->el(0)->val_decimal(&dec_buf); dec= row->el(0)->val_decimal(&dec_buf);
}
uint i;
if (row->el(0)->null_value) if (row->el(0)->null_value)
return -1; // -1 if null return -1; // -1 if null
...@@ -906,6 +914,11 @@ longlong Item_func_interval::val_int() ...@@ -906,6 +914,11 @@ longlong Item_func_interval::val_int()
uint mid= (start + end + 1) / 2; uint mid= (start + end + 1) / 2;
interval_range *range= intervals + mid; interval_range *range= intervals + mid;
my_bool cmp_result; my_bool cmp_result;
/*
The values in the range intervall may have different types,
Only do a decimal comparision of the first argument is a decimal
and we are comparing against a decimal
*/
if (dec && range->type == DECIMAL_RESULT) if (dec && range->type == DECIMAL_RESULT)
cmp_result= my_decimal_cmp(&range->dec, dec) <= 0; cmp_result= my_decimal_cmp(&range->dec, dec) <= 0;
else else
...@@ -917,7 +930,7 @@ longlong Item_func_interval::val_int() ...@@ -917,7 +930,7 @@ longlong Item_func_interval::val_int()
} }
interval_range *range= intervals+start; interval_range *range= intervals+start;
return ((dec && range->type == DECIMAL_RESULT) ? return ((dec && range->type == DECIMAL_RESULT) ?
my_decimal_cmp(dec, &range->dec) < 0 : my_decimal_cmp(dec, &range->dec) < 0 :
value < range->dbl) ? 0 : start + 1; value < range->dbl) ? 0 : start + 1;
} }
...@@ -932,13 +945,13 @@ longlong Item_func_interval::val_int() ...@@ -932,13 +945,13 @@ longlong Item_func_interval::val_int()
if (my_decimal_cmp(e_dec, dec) > 0) if (my_decimal_cmp(e_dec, dec) > 0)
return i-1; return i-1;
} }
else else if (row->el(i)->val_real() > value)
if (row->el(i)->val_real() > value) return i-1;
return i-1;
} }
return i-1; return i-1;
} }
void Item_func_between::fix_length_and_dec() void Item_func_between::fix_length_and_dec()
{ {
max_length= 1; max_length= 1;
...@@ -1087,8 +1100,7 @@ Item_func_ifnull::fix_length_and_dec() ...@@ -1087,8 +1100,7 @@ Item_func_ifnull::fix_length_and_dec()
args[1]->max_length - args[1]->decimals) + args[1]->max_length - args[1]->decimals) +
decimals); decimals);
agg_result_type(&cached_result_type, args, 2); agg_result_type(&cached_result_type, args, 2);
switch (cached_result_type) switch (cached_result_type) {
{
case STRING_RESULT: case STRING_RESULT:
agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV); agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV);
break; break;
...@@ -1166,7 +1178,6 @@ my_decimal *Item_func_ifnull::val_decimal(my_decimal *decimal_value) ...@@ -1166,7 +1178,6 @@ my_decimal *Item_func_ifnull::val_decimal(my_decimal *decimal_value)
} }
String * String *
Item_func_ifnull::val_str(String *str) Item_func_ifnull::val_str(String *str)
{ {
...@@ -1456,7 +1467,6 @@ Item *Item_func_case::find_item(String *str) ...@@ -1456,7 +1467,6 @@ Item *Item_func_case::find_item(String *str)
} }
String *Item_func_case::val_str(String *str) String *Item_func_case::val_str(String *str)
{ {
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
......
...@@ -5026,7 +5026,7 @@ select_derived: ...@@ -5026,7 +5026,7 @@ select_derived:
} }
; ;
select_derived: select_derived2:
{ {
LEX *lex= Lex; LEX *lex= Lex;
lex->derived_tables|= DERIVED_SUBQUERY; lex->derived_tables|= DERIVED_SUBQUERY;
......
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