Commit 83a4fcac authored by unknown's avatar unknown

R-tree bug fixes.


myisam/rt_index.c:
  Should call find_first() instead of find_next() after key deletion.
  Fixed type cast.
myisam/sp_key.c:
  Fixed spatial key creation.
sql/field.cc:
  To get rid of warning.
parent fe8ea234
......@@ -188,6 +188,12 @@ int rtree_find_next(MI_INFO *info, uint keynr, uint search_flag)
uint nod_cmp_flag;
MI_KEYDEF *keyinfo = info->s->keyinfo + keynr;
if (info->update & HA_STATE_DELETED)
{
return rtree_find_first(info, keynr, info->lastkey, info->lastkey_length,
search_flag);
}
if (!info->buff_used)
{
uchar *key = info->int_keypos;
......@@ -814,6 +820,7 @@ int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length)
goto err1;
info->s->state.key_root[keynr] = new_root;
}
info->update= HA_STATE_DELETED;
return 0;
err1:
......@@ -911,7 +918,7 @@ ha_rows rtree_estimate(MI_INFO *info, uint keynr, uchar *key,
if (nod_flag)
{
if (i)
res = (int)(area / i * info->state->records);
res = (ha_rows) (area / i * info->state->records);
else
res = HA_POS_ERROR;
}
......
......@@ -56,6 +56,31 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
pos = ((byte*)mbr) + keyseg->start;
if (keyseg->flag & HA_SWAP_KEY)
{
#ifdef HAVE_ISNAN
if (keyseg->type == HA_KEYTYPE_FLOAT)
{
float nr;
float4get(nr, pos);
if (isnan(nr))
{
/* Replace NAN with zero */
bzero(key, length);
key+= length;
continue;
}
}
else if (keyseg->type == HA_KEYTYPE_DOUBLE)
{
double nr;
float8get(nr, pos);
if (isnan(nr))
{
bzero(key, length);
key+= length;
continue;
}
}
#endif
pos += length;
while (length--)
{
......@@ -99,19 +124,19 @@ static int sp_add_point_to_mbr(uchar *(*wkb), uchar *end, uint n_dims,
double *mbr)
{
double ord;
double *mbr_end = mbr + n_dims * 2;
double *mbr_end= mbr + n_dims * 2;
while (mbr < mbr_end)
{
if ((*wkb) > end - 8)
return -1;
float8get(ord, (*wkb));
(*wkb) += 8;
(*wkb)+= 8;
if (ord < *mbr)
*mbr = ord;
float8store((char*) mbr, ord);
mbr++;
if (ord > *mbr)
*mbr = ord;
float8store((char*) mbr, ord);
mbr++;
}
return 0;
......
......@@ -4285,7 +4285,7 @@ Field_blob::Field_blob(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
:Field_str(ptr_arg, (1L << min(blob_pack_length,3)*8)-1L,
null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg,
table_arg, cs),
packlength(blob_pack_length), geom_flag(true)
geom_flag(true), packlength(blob_pack_length)
{
flags|= BLOB_FLAG;
if (table)
......
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