summaryrefslogtreecommitdiff
path: root/myisam/mi_rnext.c
diff options
context:
space:
mode:
authorunknown <bar@gw.udmsearch.izhnet.ru>2002-02-20 14:11:21 +0400
committerunknown <bar@gw.udmsearch.izhnet.ru>2002-02-20 14:11:21 +0400
commit3d5dc65dfd72083ed159220d03bea942094e8662 (patch)
tree20573ea174df56ec053e23fa07eb87679f3b7a38 /myisam/mi_rnext.c
parentb87d6ee9d730fb2df74a3981b552b0da2e09570c (diff)
downloadmariadb-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_rnext.c')
-rw-r--r--myisam/mi_rnext.c58
1 files changed, 44 insertions, 14 deletions
diff --git a/myisam/mi_rnext.c b/myisam/mi_rnext.c
index 6d135462f96..daab7c5f085 100644
--- a/myisam/mi_rnext.c
+++ b/myisam/mi_rnext.c
@@ -16,6 +16,8 @@
#include "myisamdef.h"
+#include "rt_index.h"
+
/*
Read next row with the same key as previous read
One may have done a write, update or delete of the previous row.
@@ -42,27 +44,55 @@ int mi_rnext(MI_INFO *info, byte *buf, int inx)
changed=_mi_test_if_changed(info);
if (!flag)
{
- error=_mi_search_first(info,info->s->keyinfo+inx,
- info->s->state.key_root[inx]);
+ switch(info->s->keyinfo[inx].key_alg){
+ case HA_KEY_ALG_RTREE:
+ error=rtree_get_first(info,inx,info->lastkey_length);
+ break;
+ case HA_KEY_ALG_BTREE:
+ default:
+ error=_mi_search_first(info,info->s->keyinfo+inx,
+ info->s->state.key_root[inx]);
+ break;
+ }
}
- else if (!changed)
- error=_mi_search_next(info,info->s->keyinfo+inx,info->lastkey,
- info->lastkey_length,flag,
- info->s->state.key_root[inx]);
else
- error=_mi_search(info,info->s->keyinfo+inx,info->lastkey,
- USE_WHOLE_KEY,flag, info->s->state.key_root[inx]);
-
- if (!error)
{
- while (info->lastpos >= info->state->data_file_length)
+ switch(info->s->keyinfo[inx].key_alg)
{
- /* Skip rows that are inserted by other threads since we got a lock */
- if ((error=_mi_search_next(info,info->s->keyinfo+inx,info->lastkey,
+ case HA_KEY_ALG_RTREE:
+ /*
+ Note that rtree doesn't support that the table
+ may be changed since last call, so we do need
+ to skip rows inserted by other threads like in btree
+ */
+ error=rtree_get_next(info,inx,info->lastkey_length);
+ break;
+
+ case HA_KEY_ALG_BTREE:
+ default:
+ if (!changed)
+ {
+ error=_mi_search_next(info,info->s->keyinfo+inx,info->lastkey,
+ info->lastkey_length,flag,
+ info->s->state.key_root[inx]);
+ }
+ else
+ {
+ error=_mi_search(info,info->s->keyinfo+inx,info->lastkey,
+ USE_WHOLE_KEY,flag, info->s->state.key_root[inx]);
+ }
+ if (!error)
+ {
+ while (info->lastpos >= info->state->data_file_length)
+ {
+ /* Skip rows that are inserted by other threads since we got a lock */
+ if ((error=_mi_search_next(info,info->s->keyinfo+inx,info->lastkey,
info->lastkey_length,
SEARCH_BIGGER,
info->s->state.key_root[inx])))
- break;
+ break;
+ }
+ }
}
}