1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Avoid using HA_POS_ERROR constant when passing around values of type double.

This is error-prone and causes warnings on Windows
This commit is contained in:
Sergei Petrunia
2017-10-03 16:05:24 +03:00
parent 325e071c11
commit ebc2f0dad3
2 changed files with 8 additions and 5 deletions

View File

@ -2827,7 +2827,7 @@ double records_in_column_ranges(PARAM *param, uint idx,
/* Handle cases when we don't have a valid non-empty list of range */
if (!tree)
return HA_POS_ERROR;
return DBL_MAX;
if (tree->type == SEL_ARG::IMPOSSIBLE)
return (0L);
@ -2847,9 +2847,9 @@ double records_in_column_ranges(PARAM *param, uint idx,
max_endp= range.end_key.length? &range.end_key : NULL;
rows= get_column_range_cardinality(field, min_endp, max_endp,
range.range_flag);
if (HA_POS_ERROR == rows)
if (DBL_MAX == rows)
{
total_rows= HA_POS_ERROR;
total_rows= DBL_MAX;
break;
}
total_rows += rows;
@ -3083,7 +3083,7 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond)
else
{
rows= records_in_column_ranges(&param, idx, key);
if (rows != HA_POS_ERROR)
if (rows != DBL_MAX)
key->field->cond_selectivity= rows/table_records;
}
}