summaryrefslogtreecommitdiff
path: root/myisam/sp_key.c
diff options
context:
space:
mode:
authorunknown <ram@mysql.r18.ru>2003-03-20 20:55:53 +0400
committerunknown <ram@mysql.r18.ru>2003-03-20 20:55:53 +0400
commit83a4fcac5c3990772e7be06cf6a5cda4f869d65a (patch)
tree3258f00442555f5093bdd2a6d0523cf194e9537b /myisam/sp_key.c
parentfe8ea234c9c8cd29f487f839d9ec875043bc25ce (diff)
downloadmariadb-git-83a4fcac5c3990772e7be06cf6a5cda4f869d65a.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/sp_key.c')
-rw-r--r--myisam/sp_key.c33
1 files changed, 29 insertions, 4 deletions
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;