summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
Diffstat (limited to 'myisam')
-rw-r--r--myisam/ft_boolean_search.c2
-rw-r--r--myisam/mi_check.c10
-rw-r--r--myisam/mi_rnext_same.c4
-rw-r--r--myisam/mi_write.c7
-rw-r--r--myisam/rt_index.c3
-rw-r--r--myisam/sort.c7
-rw-r--r--myisam/sp_key.c5
7 files changed, 30 insertions, 8 deletions
diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c
index c432ac5a16c..ffc7e1bf104 100644
--- a/myisam/ft_boolean_search.c
+++ b/myisam/ft_boolean_search.c
@@ -155,7 +155,7 @@ static void _ftb_parse_query(FTB *ftb, byte **start, byte *end,
ftbw=(FTB_WORD *)alloc_root(&ftb->mem_root,
sizeof(FTB_WORD) +
(param.trunc ? MI_MAX_KEY_BUFF :
- w.len+extra));
+ w.len*ftb->charset->mbmaxlen+extra));
ftbw->len=w.len+1;
ftbw->flags=0;
ftbw->off=0;
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index b8f992dc21a..dcf57e78fa4 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -26,6 +26,7 @@
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
+#include "rt_index.h"
#ifndef USE_RAID
#define my_raid_create(A,B,C,D,E,F,G) my_create(A,B,C,G)
@@ -1466,6 +1467,12 @@ static int writekeys(MI_CHECK *param, register MI_INFO *info, byte *buff,
if (_mi_ft_add(info,i,(char*) key,buff,filepos))
goto err;
}
+ else if (info->s->keyinfo[i].flag & HA_SPATIAL)
+ {
+ uint key_length=_mi_make_key(info,i,key,buff,filepos);
+ if (rtree_insert(info, i, key, key_length))
+ goto err;
+ }
else
{
uint key_length=_mi_make_key(info,i,key,buff,filepos);
@@ -3988,7 +3995,8 @@ static my_bool mi_too_big_key_for_sort(MI_KEYDEF *key, ha_rows rows)
key->seg->charset->mbmaxlen;
key_maxlength+=ft_max_word_len_for_sort-HA_FT_MAXBYTELEN;
}
- return (key->flag & (HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY | HA_FULLTEXT) &&
+ return (key->flag & HA_SPATIAL) ||
+ (key->flag & (HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY | HA_FULLTEXT) &&
((ulonglong) rows * key_maxlength >
(ulonglong) myisam_max_temp_length));
}
diff --git a/myisam/mi_rnext_same.c b/myisam/mi_rnext_same.c
index 3060a55038a..06408f57a3f 100644
--- a/myisam/mi_rnext_same.c
+++ b/myisam/mi_rnext_same.c
@@ -92,6 +92,10 @@ int mi_rnext_same(MI_INFO *info, byte *buf)
if (my_errno == HA_ERR_KEY_NOT_FOUND)
my_errno=HA_ERR_END_OF_FILE;
}
+ else if (!buf)
+ {
+ DBUG_RETURN(info->lastpos==HA_OFFSET_ERROR ? my_errno : 0);
+ }
else if (!(*info->read_record)(info,info->lastpos,buf))
{
info->update|= HA_STATE_AKTIV; /* Record is read */
diff --git a/myisam/mi_write.c b/myisam/mi_write.c
index c2f24ae1ae3..019c372a885 100644
--- a/myisam/mi_write.c
+++ b/myisam/mi_write.c
@@ -124,8 +124,8 @@ int mi_write(MI_INFO *info, byte *record)
{
if (local_lock_tree)
rw_unlock(&share->key_root_lock[i]);
- DBUG_PRINT("error",("Got error: %d on write",my_errno));
- goto err;
+ DBUG_PRINT("error",("Got error: %d on write",my_errno));
+ goto err;
}
}
if (local_lock_tree)
@@ -159,7 +159,8 @@ int mi_write(MI_INFO *info, byte *record)
err:
save_errno=my_errno;
- if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_RECORD_FILE_FULL)
+ if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_RECORD_FILE_FULL ||
+ my_errno == HA_ERR_NULL_IN_SPATIAL)
{
if (info->bulk_insert)
{
diff --git a/myisam/rt_index.c b/myisam/rt_index.c
index cfb2ca877f4..bdf5ee9c60f 100644
--- a/myisam/rt_index.c
+++ b/myisam/rt_index.c
@@ -710,7 +710,8 @@ err1:
int rtree_insert(MI_INFO *info, uint keynr, uchar *key, uint key_length)
{
- return (rtree_insert_level(info, keynr, key, key_length, -1) == -1) ? -1 : 0;
+ return (!key_length ||
+ (rtree_insert_level(info, keynr, key, key_length, -1) == -1)) ? -1 : 0;
}
diff --git a/myisam/sort.c b/myisam/sort.c
index 5537ba55c7d..09dd45f388c 100644
--- a/myisam/sort.c
+++ b/myisam/sort.c
@@ -84,7 +84,9 @@ static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info,
IO_CACHE *to_file,
char* key, uint sort_length,
uint count);
-inline int my_var_write(MI_SORT_PARAM *info,IO_CACHE *to_file, byte *bufs);
+static inline int
+my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, byte *bufs);
+
/*
Creates a index of sorted keys
@@ -625,7 +627,8 @@ static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys,
} /* write_keys */
-inline int my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, byte *bufs)
+static inline int
+my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, byte *bufs)
{
int err;
uint16 len = _mi_keylength(info->keyinfo, (uchar*) bufs);
diff --git a/myisam/sp_key.c b/myisam/sp_key.c
index 0e424a9e193..b61e8094cde 100644
--- a/myisam/sp_key.c
+++ b/myisam/sp_key.c
@@ -50,6 +50,11 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
dlen = _mi_calc_blob_length(keyseg->bit_start, pos);
memcpy_fixed(&dptr, pos + keyseg->bit_start, sizeof(char*));
+ if (!dptr)
+ {
+ my_errno= HA_ERR_NULL_IN_SPATIAL;
+ return 0;
+ }
sp_mbr_from_wkb(dptr + 4, dlen - 4, SPDIMS, mbr); /* SRID */
for (i = 0, keyseg = keyinfo->seg; keyseg->type; keyseg++, i++)