diff options
author | unknown <ram@mysql.r18.ru> | 2003-03-20 20:55:53 +0400 |
---|---|---|
committer | unknown <ram@mysql.r18.ru> | 2003-03-20 20:55:53 +0400 |
commit | 913cd2e4a0b64163c1c282e7db73363bc09649fd (patch) | |
tree | 3258f00442555f5093bdd2a6d0523cf194e9537b /myisam | |
parent | f799da46e33bc16c14f03031362a3f2d3105352c (diff) | |
download | mariadb-git-913cd2e4a0b64163c1c282e7db73363bc09649fd.tar.gz |
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.
Diffstat (limited to 'myisam')
-rw-r--r-- | myisam/rt_index.c | 9 | ||||
-rw-r--r-- | myisam/sp_key.c | 33 |
2 files changed, 37 insertions, 5 deletions
diff --git a/myisam/rt_index.c b/myisam/rt_index.c index e3f64940203..f02d6121eb5 100644 --- a/myisam/rt_index.c +++ b/myisam/rt_index.c @@ -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; } diff --git a/myisam/sp_key.c b/myisam/sp_key.c index f0b53b541b8..f669d217026 100644 --- a/myisam/sp_key.c +++ b/myisam/sp_key.c @@ -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; |