mirror of
https://github.com/MariaDB/server.git
synced 2025-08-31 22:22:30 +03:00
Merge bk-internal:/home/bk/mysql-5.0
into magare.gmz:/home/kgeorge/mysql/work/merge-5.0-bugteam
This commit is contained in:
11
sql/item.cc
11
sql/item.cc
@@ -4156,9 +4156,14 @@ static void convert_zerofill_number_to_string(Item **item, Field_num *field)
|
||||
String tmp(buff,sizeof(buff), field->charset()), *res;
|
||||
|
||||
res= (*item)->val_str(&tmp);
|
||||
field->prepend_zeros(res);
|
||||
pos= (char *) sql_strmake (res->ptr(), res->length());
|
||||
*item= new Item_string(pos, res->length(), field->charset());
|
||||
if ((*item)->is_null())
|
||||
*item= new Item_null();
|
||||
else
|
||||
{
|
||||
field->prepend_zeros(res);
|
||||
pos= (char *) sql_strmake (res->ptr(), res->length());
|
||||
*item= new Item_string(pos, res->length(), field->charset());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -164,14 +164,23 @@ inline int check_result_and_overflow(uint mask, int result, my_decimal *val)
|
||||
inline uint my_decimal_length_to_precision(uint length, uint scale,
|
||||
bool unsigned_flag)
|
||||
{
|
||||
return (uint) (length - (scale>0 ? 1:0) - (unsigned_flag ? 0:1));
|
||||
/* Precision can't be negative thus ignore unsigned_flag when length is 0. */
|
||||
DBUG_ASSERT(length || !scale);
|
||||
return (uint) (length - (scale>0 ? 1:0) -
|
||||
(unsigned_flag || !length ? 0:1));
|
||||
}
|
||||
|
||||
inline uint32 my_decimal_precision_to_length(uint precision, uint8 scale,
|
||||
bool unsigned_flag)
|
||||
{
|
||||
/*
|
||||
When precision is 0 it means that original length was also 0. Thus
|
||||
unsigned_flag is ignored in this case.
|
||||
*/
|
||||
DBUG_ASSERT(precision || !scale);
|
||||
set_if_smaller(precision, DECIMAL_MAX_PRECISION);
|
||||
return (uint32)(precision + (scale>0 ? 1:0) + (unsigned_flag ? 0:1));
|
||||
return (uint32)(precision + (scale>0 ? 1:0) +
|
||||
(unsigned_flag || !precision ? 0:1));
|
||||
}
|
||||
|
||||
inline
|
||||
|
@@ -832,6 +832,7 @@ JOIN::optimize()
|
||||
"Impossible HAVING" : "Impossible WHERE"));
|
||||
zero_result_cause= having_value == Item::COND_FALSE ?
|
||||
"Impossible HAVING" : "Impossible WHERE";
|
||||
tables= 0;
|
||||
error= 0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user