diff options
author | monty@mysql.com <> | 2004-12-31 00:50:30 +0200 |
---|---|---|
committer | monty@mysql.com <> | 2004-12-31 00:50:30 +0200 |
commit | 34d5331cee44cdcb62245779ad486ccbef6bf4c2 (patch) | |
tree | d4dfebc9b9c93790a9be3f9e6807f3923a6b3d3e /myisam | |
parent | 4dbd101c571a71db38d4ecb61f3ce6b87012122a (diff) | |
parent | d71c030587c8638422c5e7d23043430f2733575b (diff) | |
download | mariadb-git-34d5331cee44cdcb62245779ad486ccbef6bf4c2.tar.gz |
Merge with global tree
Diffstat (limited to 'myisam')
-rw-r--r-- | myisam/ft_boolean_search.c | 3 | ||||
-rw-r--r-- | myisam/ft_static.c | 36 | ||||
-rw-r--r-- | myisam/mi_check.c | 10 | ||||
-rw-r--r-- | myisam/mi_open.c | 14 | ||||
-rw-r--r-- | myisam/mi_rnext_same.c | 4 | ||||
-rw-r--r-- | myisam/mi_write.c | 7 | ||||
-rw-r--r-- | myisam/rt_index.c | 3 | ||||
-rw-r--r-- | myisam/sort.c | 7 | ||||
-rw-r--r-- | myisam/sp_key.c | 5 |
9 files changed, 58 insertions, 31 deletions
diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c index c432ac5a16c..c38bffed665 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; @@ -211,6 +211,7 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search) uint off, extra=HA_FT_WLEN+info->s->base.rec_reflength; byte *lastkey_buf=ftbw->word+ftbw->off; + LINT_INIT(off); if (ftbw->flags & FTB_FLAG_TRUNC) lastkey_buf+=ftbw->len; diff --git a/myisam/ft_static.c b/myisam/ft_static.c index cdb1580e706..5241a492f58 100644 --- a/myisam/ft_static.c +++ b/myisam/ft_static.c @@ -25,23 +25,25 @@ char ft_boolean_syntax[]="+ -><()~*:\"\"&|"; const HA_KEYSEG ft_keysegs[FT_SEGS]={ { - HA_KEYTYPE_VARTEXT2, /* type */ - 63, /* language (will be overwritten) */ - 0, 2, 0, /* null_bit, bit_start, bit_end */ - HA_VAR_LENGTH_PART | HA_PACK_KEY, /* flag */ - HA_FT_MAXBYTELEN, /* length */ - HA_FT_WLEN, /* start */ - 0, /* null_pos */ - NULL /* charset */ - }, - { -/* - Note, this (and the last HA_KEYTYPE_END) segment should NOT - be packed in any way, otherwise w_search() won't be able to - update key entry 'in vivo' -*/ - HA_FT_WTYPE, 63, 0, 0, 0, HA_NO_SORT, HA_FT_WLEN, 0, 0, NULL - } + NullS, /* charset */ + HA_FT_WLEN, /* start */ + 0, /* null_pos */ + 0, /* Bit pos */ + HA_VAR_LENGTH_PART | HA_PACK_KEY, /* flag */ + HA_FT_MAXBYTELEN, /* length */ + HA_KEYTYPE_VARTEXT2, /* type */ + 63, /* language (will be overwritten) */ + 0, /* null_bit */ + 2, 0, 0 /* bit_start, bit_end, bit_length */ +}, +{ + /* + Note, this (and the last HA_KEYTYPE_END) segment should NOT + be packed in any way, otherwise w_search() won't be able to + update key entry 'in vivo' + */ + NullS, 0, 0, 0, HA_NO_SORT, HA_FT_WLEN, HA_FT_WTYPE, 63, 0, 0, 0, 0 +} }; const struct _ft_vft _ft_vft_nlq = { 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_open.c b/myisam/mi_open.c index 040bc1503aa..03364ea7c29 100644 --- a/myisam/mi_open.c +++ b/myisam/mi_open.c @@ -1057,17 +1057,19 @@ int mi_keyseg_write(File file, const HA_KEYSEG *keyseg) { uchar buff[HA_KEYSEG_SIZE]; uchar *ptr=buff; + ulong pos; - *ptr++ =keyseg->type; - *ptr++ =keyseg->language; - *ptr++ =keyseg->null_bit; - *ptr++ =keyseg->bit_start; - *ptr++ =keyseg->bit_end; + *ptr++= keyseg->type; + *ptr++= keyseg->language; + *ptr++= keyseg->null_bit; + *ptr++= keyseg->bit_start; + *ptr++= keyseg->bit_end; *ptr++= keyseg->bit_length; mi_int2store(ptr,keyseg->flag); ptr+=2; mi_int2store(ptr,keyseg->length); ptr+=2; mi_int4store(ptr,keyseg->start); ptr+=4; - mi_int4store(ptr, keyseg->null_bit ? keyseg->null_pos : keyseg->bit_pos); + pos= keyseg->null_bit ? keyseg->null_pos : keyseg->bit_pos; + mi_int4store(ptr, pos); ptr+=4; return my_write(file,(char*) buff, (uint) (ptr-buff), MYF(MY_NABP)); 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 8ff653bdd2d..76d066ee845 100644 --- a/myisam/mi_write.c +++ b/myisam/mi_write.c @@ -127,8 +127,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) @@ -162,7 +162,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++) |