summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@gleb.loc>2007-07-13 20:52:03 +0500
committerunknown <gshchepa/uchum@gleb.loc>2007-07-13 20:52:03 +0500
commitec8a6c77cb2ff50ef509bb01b8d4cb356fe17071 (patch)
treedbd68b76ccd2f2530e1026a54416981b2f43633e /storage
parent22531a8e7b6f83d7059e703e52b5bcf78d0b1a73 (diff)
parentfde9c7d5b8ce11a126e586b7cd216a0d1962d3b6 (diff)
downloadmariadb-git-ec8a6c77cb2ff50ef509bb01b8d4cb356fe17071.tar.gz
Merge gleb.loc:/home/uchum/work/bk/5.1
into gleb.loc:/home/uchum/work/bk/5.1-opt sql/sql_class.h: Auto merged
Diffstat (limited to 'storage')
-rw-r--r--storage/myisam/ha_myisam.cc2
-rw-r--r--storage/myisam/mi_create.c4
-rw-r--r--storage/myisam/sp_key.c71
3 files changed, 33 insertions, 44 deletions
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index 98f74247707..3614166e97c 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -1889,6 +1889,8 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
if (ha_create_info->options & HA_LEX_CREATE_TMP_TABLE)
create_flags|= HA_CREATE_TMP_TABLE;
+ if (ha_create_info->options & HA_CREATE_KEEP_FILES)
+ create_flags|= HA_CREATE_KEEP_FILES;
if (options & HA_OPTION_PACK_RECORD)
create_flags|= HA_PACK_RECORD;
if (options & HA_OPTION_CHECKSUM)
diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c
index c177aa8d987..0cac5f08b3b 100644
--- a/storage/myisam/mi_create.c
+++ b/storage/myisam/mi_create.c
@@ -615,7 +615,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
(have_iext ? MY_REPLACE_EXT : MY_APPEND_EXT));
linkname_ptr=0;
/* Replace the current file */
- create_flag=MY_DELETE_OLD;
+ create_flag=(flags & HA_CREATE_KEEP_FILES) ? 0 : MY_DELETE_OLD;
}
/*
@@ -689,7 +689,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
fn_format(filename,name,"", MI_NAME_DEXT,
MY_UNPACK_FILENAME | MY_APPEND_EXT);
linkname_ptr=0;
- create_flag=MY_DELETE_OLD;
+ create_flag=(flags & HA_CREATE_KEEP_FILES) ? 0 : MY_DELETE_OLD;
}
if ((dfile=
my_create_with_symlink(linkname_ptr, filename, 0, create_mode,
diff --git a/storage/myisam/sp_key.c b/storage/myisam/sp_key.c
index be4021935c4..3748a38ff81 100644
--- a/storage/myisam/sp_key.c
+++ b/storage/myisam/sp_key.c
@@ -31,11 +31,6 @@ static int sp_get_geometry_mbr(uchar *(*wkb), uchar *end, uint n_dims,
double *mbr, int top);
static int sp_mbr_from_wkb(uchar (*wkb), uint size, uint n_dims, double *mbr);
-static void get_double(double *d, const uchar *pos)
-{
- float8get(*d, pos);
-}
-
uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
const uchar *record, my_off_t filepos)
{
@@ -62,48 +57,40 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
for (i = 0, keyseg = keyinfo->seg; keyseg->type; keyseg++, i++)
{
- uint length = keyseg->length;
+ uint length = keyseg->length, start= keyseg->start;
+ double val;
+
+ DBUG_ASSERT(length == sizeof(double));
+ DBUG_ASSERT(!(start % sizeof(double)));
+ DBUG_ASSERT(start < sizeof(mbr));
+ DBUG_ASSERT(keyseg->type == HA_KEYTYPE_DOUBLE);
- pos = ((uchar*)mbr) + keyseg->start;
- if (keyseg->flag & HA_SWAP_KEY)
- {
+ val= mbr[start / sizeof (double)];
#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;
- get_double(&nr, pos);
- if (isnan(nr))
- {
- bzero(key, length);
- key+= length;
- continue;
- }
- }
+ if (isnan(val))
+ {
+ bzero(key, length);
+ key+= length;
+ len+= length;
+ continue;
+ }
#endif
- pos += length;
- while (length--)
- {
+
+ if (keyseg->flag & HA_SWAP_KEY)
+ {
+ uchar buf[sizeof(double)];
+
+ float8store(buf, val);
+ pos= &buf[length];
+ while (pos > buf)
*key++ = *--pos;
- }
}
else
{
- memcpy((uchar*)key, pos, length);
- key += keyseg->length;
+ float8store((uchar *)key, val);
+ key += length;
}
- len += keyseg->length;
+ len+= length;
}
_mi_dpointer(info, key, filepos);
return len;
@@ -141,13 +128,13 @@ static int sp_add_point_to_mbr(uchar *(*wkb), uchar *end, uint n_dims,
{
if ((*wkb) > end - 8)
return -1;
- get_double(&ord, (const uchar*) *wkb);
+ float8get(ord, (const uchar*) *wkb);
(*wkb)+= 8;
if (ord < *mbr)
- float8store((char*) mbr, ord);
+ *mbr= ord;
mbr++;
if (ord > *mbr)
- float8store((char*) mbr, ord);
+ *mbr= ord;
mbr++;
}
return 0;