diff options
author | unknown <bar@gw.udmsearch.izhnet.ru> | 2002-02-20 14:11:21 +0400 |
---|---|---|
committer | unknown <bar@gw.udmsearch.izhnet.ru> | 2002-02-20 14:11:21 +0400 |
commit | 3d5dc65dfd72083ed159220d03bea942094e8662 (patch) | |
tree | 20573ea174df56ec053e23fa07eb87679f3b7a38 /myisam/mi_rkey.c | |
parent | b87d6ee9d730fb2df74a3981b552b0da2e09570c (diff) | |
download | mariadb-git-3d5dc65dfd72083ed159220d03bea942094e8662.tar.gz |
This ChangeSet adds RTREE support into myisam library.
RTREEs will be used for GIS extension in MySQL
myisam/.cvsignore:
Added sp_test and rt_test
myisam/Makefile.am:
Added RTREE files
myisam/mi_create.c:
Added RTREE/SPATIAL initialization
myisam/mi_delete.c:
Switched to use virual function, instead of mi_ck_delete() direct call
myisam/mi_key.c:
Added sp_make_key() call in the case of SPATIAL index type
myisam/mi_open.c:
Added some new initialization actions which depend on key_alg being used: RTREE or BTREE
myisam/mi_range.c:
Rtree estimation
myisam/mi_rkey.c:
rtree
myisam/mi_rnext.c:
rtree
myisam/mi_rnext_same.c:
rtree
myisam/mi_static.c:
New search flags for bounding rectungles
myisam/mi_test1.c:
one now should always specify key_alg during keyinfo initializing: BTREE or RTREE
myisam/mi_test2.c:
Added key_alg initializing
myisam/mi_test3.c:
Added key_alg initialization
myisam/mi_update.c:
Switched to virtual functions, instead of mi_ck_delete/mi_ck_write direct call
myisam/mi_write.c:
Virtual function instead of mi_ck_write() direct call
myisam/myisamdef.h:
Rtree additions
Diffstat (limited to 'myisam/mi_rkey.c')
-rw-r--r-- | myisam/mi_rkey.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/myisam/mi_rkey.c b/myisam/mi_rkey.c index 86547d3ef04..cefb7a74dd1 100644 --- a/myisam/mi_rkey.c +++ b/myisam/mi_rkey.c @@ -17,7 +17,7 @@ /* Read record based on a key */ #include "myisamdef.h" - +#include "rt_index.h" /* Read a record using key */ /* Ordinary search_flag is 0 ; Give error if no record with key */ @@ -36,6 +36,7 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len, DBUG_RETURN(my_errno); info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); + info->last_key_func=search_flag; if (!info->use_packed_key) { @@ -65,22 +66,33 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len, if (!(nextflag & (SEARCH_FIND | SEARCH_NO_FIND | SEARCH_LAST))) use_key_length=USE_WHOLE_KEY; - if (!_mi_search(info,info->s->keyinfo+inx,key_buff,use_key_length, + switch(info->s->keyinfo[inx].key_alg){ + case HA_KEY_ALG_RTREE: + if(rtree_find_first(info,inx,key_buff,use_key_length,nextflag)<0) + { + my_errno=HA_ERR_CRASHED; + goto err; + } + break; + case HA_KEY_ALG_BTREE: + default: + if (!_mi_search(info,info->s->keyinfo+inx,key_buff,use_key_length, myisam_read_vec[search_flag],info->s->state.key_root[inx])) - { - while (info->lastpos >= info->state->data_file_length) { - /* - Skip rows that are inserted by other threads since we got a lock - Note that this can only happen if we are not searching after an - exact key, because the keys are sorted according to position - */ - - if (_mi_search_next(info,info->s->keyinfo+inx,info->lastkey, + while (info->lastpos >= info->state->data_file_length) + { + /* + Skip rows that are inserted by other threads since we got a lock + Note that this can only happen if we are not searching after an + exact key, because the keys are sorted according to position + */ + + if (_mi_search_next(info,info->s->keyinfo+inx,info->lastkey, info->lastkey_length, myisam_readnext_vec[search_flag], info->s->state.key_root[inx])) - break; + break; + } } } if (share->concurrent_insert) |