summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <hf@deer.(none)>2004-05-27 17:27:42 +0500
committerunknown <hf@deer.(none)>2004-05-27 17:27:42 +0500
commitd366a2e4c97155d5ea10a7da084d188d7e42222c (patch)
tree4cdeb9b944561edf1740e35f53a02205b9376f32 /myisam
parent5df707c7c9fe5ac760c7136ee806be718d2afa04 (diff)
parent7f49646cf3be49c0f9a9a9f8599e9bea2223e08a (diff)
downloadmariadb-git-d366a2e4c97155d5ea10a7da084d188d7e42222c.tar.gz
Merge abotchkov@bk-internal.mysql.com:/home/bk/mysql-4.1
into deer.(none):/home/hf/work/mysql-4.1.spa
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_create.c7
-rw-r--r--myisam/mi_key.c4
-rw-r--r--myisam/mi_open.c9
-rw-r--r--myisam/mi_range.c2
-rw-r--r--myisam/mi_rkey.c2
-rw-r--r--myisam/mi_rnext.c5
-rw-r--r--myisam/mi_rnext_same.c2
-rw-r--r--myisam/rt_index.c5
-rw-r--r--myisam/rt_index.h3
-rw-r--r--myisam/rt_key.c3
-rw-r--r--myisam/rt_key.h3
-rw-r--r--myisam/rt_mbr.c4
-rw-r--r--myisam/rt_mbr.h3
-rw-r--r--myisam/rt_split.c4
-rw-r--r--myisam/rt_test.c10
-rw-r--r--myisam/sp_defs.h3
-rw-r--r--myisam/sp_key.c5
-rw-r--r--myisam/sp_test.c10
18 files changed, 83 insertions, 1 deletions
diff --git a/myisam/mi_create.c b/myisam/mi_create.c
index 838d647ea56..683640630f6 100644
--- a/myisam/mi_create.c
+++ b/myisam/mi_create.c
@@ -242,6 +242,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
key_length=pointer;
if (keydef->flag & HA_SPATIAL)
{
+#ifdef HAVE_SPATIAL
/* BAR TODO to support 3D and more dimensions in the future */
uint sp_segs=SPDIMS*2;
keydef->flag=HA_SPATIAL;
@@ -270,6 +271,10 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
key_length+=SPLEN*sp_segs;
length++; /* At least one length byte */
min_key_length_skip+=SPLEN*2*SPDIMS;
+#else
+ my_errno= HA_ERR_UNSUPPORTED;
+ goto err;
+#endif /*HAVE_SPATIAL*/
}
else
if (keydef->flag & HA_FULLTEXT)
@@ -588,6 +593,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
for (j=0 ; j < keydefs[i].keysegs-sp_segs ; j++)
if (mi_keyseg_write(file, &keydefs[i].seg[j]))
goto err;
+#ifdef HAVE_SPATIAL
for (j=0 ; j < sp_segs ; j++)
{
HA_KEYSEG sseg;
@@ -603,6 +609,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
if (mi_keyseg_write(file, &sseg))
goto err;
}
+#endif
}
/* Create extra keys for unique definitions */
offset=reclength-uniques*MI_UNIQUE_HASH_LENGTH;
diff --git a/myisam/mi_key.c b/myisam/mi_key.c
index 97af156e89a..d81584d648b 100644
--- a/myisam/mi_key.c
+++ b/myisam/mi_key.c
@@ -46,7 +46,11 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
/*
TODO: nulls processing
*/
+#ifdef HAVE_SPATIAL
return sp_make_key(info,keynr,key,record,filepos);
+#else
+ DBUG_ASSERT(0); /* mi_open should check that this never happens*/
+#endif
}
start=key;
diff --git a/myisam/mi_open.c b/myisam/mi_open.c
index 53cf87b24b4..562227d2f03 100644
--- a/myisam/mi_open.c
+++ b/myisam/mi_open.c
@@ -327,9 +327,14 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
}
if (share->keyinfo[i].flag & HA_SPATIAL)
{
+#ifdef HAVE_SPATIAL
uint sp_segs=SPDIMS*2;
share->keyinfo[i].seg=pos-sp_segs;
share->keyinfo[i].keysegs--;
+#else
+ my_errno=HA_ERR_UNSUPPORTED;
+ goto err;
+#endif
}
else if (share->keyinfo[i].flag & HA_FULLTEXT)
{
@@ -726,8 +731,12 @@ static void setup_key_functions(register MI_KEYDEF *keyinfo)
{
if (keyinfo->key_alg == HA_KEY_ALG_RTREE)
{
+#ifdef HAVE_RTREE_KEYS
keyinfo->ck_insert = rtree_insert;
keyinfo->ck_delete = rtree_delete;
+#else
+ DBUG_ASSERT(0); /* mi_open should check it never happens */
+#endif
}
else
{
diff --git a/myisam/mi_range.c b/myisam/mi_range.c
index db01ada16dd..1e0fd42334e 100644
--- a/myisam/mi_range.c
+++ b/myisam/mi_range.c
@@ -65,6 +65,7 @@ ha_rows mi_records_in_range(MI_INFO *info, int inx, key_range *min_key,
rw_rdlock(&info->s->key_root_lock[inx]);
switch(info->s->keyinfo[inx].key_alg){
+#ifdef HAVE_RTREE_KEYS
case HA_KEY_ALG_RTREE:
{
uchar * key_buff;
@@ -79,6 +80,7 @@ ha_rows mi_records_in_range(MI_INFO *info, int inx, key_range *min_key,
res= res ? res : 1; /* Don't return 0 */
break;
}
+#endif
case HA_KEY_ALG_BTREE:
default:
start_pos= (min_key ?
diff --git a/myisam/mi_rkey.c b/myisam/mi_rkey.c
index ddfac0a39a2..12db00337ee 100644
--- a/myisam/mi_rkey.c
+++ b/myisam/mi_rkey.c
@@ -74,6 +74,7 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
use_key_length=USE_WHOLE_KEY;
switch (info->s->keyinfo[inx].key_alg) {
+#ifdef HAVE_RTREE_KEYS
case HA_KEY_ALG_RTREE:
if (rtree_find_first(info,inx,key_buff,use_key_length,nextflag) < 0)
{
@@ -81,6 +82,7 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
goto err;
}
break;
+#endif
case HA_KEY_ALG_BTREE:
default:
if (!_mi_search(info, keyinfo, key_buff, use_key_length,
diff --git a/myisam/mi_rnext.c b/myisam/mi_rnext.c
index 6e6056f98d9..69bf5c8deae 100644
--- a/myisam/mi_rnext.c
+++ b/myisam/mi_rnext.c
@@ -45,9 +45,11 @@ int mi_rnext(MI_INFO *info, byte *buf, int inx)
if (!flag)
{
switch(info->s->keyinfo[inx].key_alg){
+#ifdef HAVE_RTREE_KEYS
case HA_KEY_ALG_RTREE:
error=rtree_get_first(info,inx,info->lastkey_length);
break;
+#endif
case HA_KEY_ALG_BTREE:
default:
error=_mi_search_first(info,info->s->keyinfo+inx,
@@ -58,6 +60,7 @@ int mi_rnext(MI_INFO *info, byte *buf, int inx)
else
{
switch (info->s->keyinfo[inx].key_alg) {
+#ifdef HAVE_RTREE_KEYS
case HA_KEY_ALG_RTREE:
/*
Note that rtree doesn't support that the table
@@ -66,7 +69,7 @@ int mi_rnext(MI_INFO *info, byte *buf, int inx)
*/
error= rtree_get_next(info,inx,info->lastkey_length);
break;
-
+#endif
case HA_KEY_ALG_BTREE:
default:
if (!changed)
diff --git a/myisam/mi_rnext_same.c b/myisam/mi_rnext_same.c
index 19190a60246..1342718d6aa 100644
--- a/myisam/mi_rnext_same.c
+++ b/myisam/mi_rnext_same.c
@@ -43,6 +43,7 @@ int mi_rnext_same(MI_INFO *info, byte *buf)
switch (keyinfo->key_alg)
{
+#ifdef HAVE_RTREE_KEYS
case HA_KEY_ALG_RTREE:
if ((error=rtree_find_next(info,inx,
myisam_read_vec[info->last_key_func])))
@@ -53,6 +54,7 @@ int mi_rnext_same(MI_INFO *info, byte *buf)
break;
}
break;
+#endif
case HA_KEY_ALG_BTREE:
default:
memcpy(info->lastkey2,info->lastkey,info->last_rkey_length);
diff --git a/myisam/rt_index.c b/myisam/rt_index.c
index 30146b9fd67..6a2606a1f8e 100644
--- a/myisam/rt_index.c
+++ b/myisam/rt_index.c
@@ -17,6 +17,8 @@
#include "myisamdef.h"
+#ifdef HAVE_RTREE_KEYS
+
#include "rt_index.h"
#include "rt_key.h"
#include "rt_mbr.h"
@@ -991,3 +993,6 @@ err1:
my_afree((byte*)page_buf);
return HA_POS_ERROR;
}
+
+#endif /*HAVE_RTREE_KEYS*/
+
diff --git a/myisam/rt_index.h b/myisam/rt_index.h
index 1a0fce72a82..1a24c403043 100644
--- a/myisam/rt_index.h
+++ b/myisam/rt_index.h
@@ -18,6 +18,8 @@
#ifndef _rt_index_h
#define _rt_index_h
+#ifdef HAVE_RTREE_KEYS
+
#define rt_PAGE_FIRST_KEY(page, nod_flag) (page + 2 + nod_flag)
#define rt_PAGE_NEXT_KEY(key, key_length, nod_flag) (key + key_length + \
(nod_flag ? nod_flag : info->s->base.rec_reflength))
@@ -41,4 +43,5 @@ ha_rows rtree_estimate(MI_INFO *info, uint keynr, uchar *key,
int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key,
uint key_length, my_off_t *new_page_offs);
+#endif /*HAVE_RTREE_KEYS*/
#endif /* _rt_index_h */
diff --git a/myisam/rt_key.c b/myisam/rt_key.c
index f18d13af8d8..e05bb744cc1 100644
--- a/myisam/rt_key.c
+++ b/myisam/rt_key.c
@@ -16,6 +16,7 @@
#include "myisamdef.h"
+#ifdef HAVE_RTREE_KEYS
#include "rt_index.h"
#include "rt_key.h"
#include "rt_mbr.h"
@@ -137,3 +138,5 @@ uchar *rtree_choose_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
}
return best_key;
}
+
+#endif /*HAVE_RTREE_KEYS*/
diff --git a/myisam/rt_key.h b/myisam/rt_key.h
index dfd7b874b54..92e10d04783 100644
--- a/myisam/rt_key.h
+++ b/myisam/rt_key.h
@@ -20,6 +20,8 @@
#ifndef _rt_key_h
#define _rt_key_h
+#ifdef HAVE_RTREE_KEYS
+
int rtree_add_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
uint key_length, uchar *page_buf, my_off_t *new_page);
int rtree_delete_key(MI_INFO *info, uchar *page, uchar *key,
@@ -28,4 +30,5 @@ int rtree_set_key_mbr(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
uint key_length, my_off_t child_page);
uchar *rtree_choose_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
uint key_length, uchar *page_buf, uint nod_flag);
+#endif /*HAVE_RTREE_KEYS*/
#endif /* _rt_key_h */
diff --git a/myisam/rt_mbr.c b/myisam/rt_mbr.c
index bb13c0769b3..c7864228e08 100644
--- a/myisam/rt_mbr.c
+++ b/myisam/rt_mbr.c
@@ -17,6 +17,8 @@
#include "myisamdef.h"
+#ifdef HAVE_RTREE_KEYS
+
#include "rt_index.h"
#include "rt_mbr.h"
@@ -757,3 +759,5 @@ int rtree_page_mbr(MI_INFO *info, HA_KEYSEG *keyseg, uchar *page_buf,
}
return 0;
}
+
+#endif /*HAVE_RTREE_KEYS*/
diff --git a/myisam/rt_mbr.h b/myisam/rt_mbr.h
index a68807370f9..1367163da79 100644
--- a/myisam/rt_mbr.h
+++ b/myisam/rt_mbr.h
@@ -18,6 +18,8 @@
#ifndef _rt_mbr_h
#define _rt_mbr_h
+#ifdef HAVE_RTREE_KEYS
+
int rtree_key_cmp(HA_KEYSEG *keyseg, uchar *a, uchar *b, uint key_length,
uint nextflag);
int rtree_combine_rect(HA_KEYSEG *keyseg,uchar *, uchar *, uchar*,
@@ -30,4 +32,5 @@ double rtree_area_increase(HA_KEYSEG *keyseg, uchar *a, uchar *b,
uint key_length, double *ab_area);
int rtree_page_mbr(MI_INFO *info, HA_KEYSEG *keyseg, uchar *page_buf,
uchar* c, uint key_length);
+#endif /*HAVE_RTREE_KEYS*/
#endif /* _rt_mbr_h */
diff --git a/myisam/rt_split.c b/myisam/rt_split.c
index 62b8ea6a65b..ccc4c0733f4 100644
--- a/myisam/rt_split.c
+++ b/myisam/rt_split.c
@@ -17,6 +17,8 @@
#include "myisamdef.h"
+#ifdef HAVE_RTREE_KEYS
+
#include "rt_index.h"
#include "rt_key.h"
#include "rt_mbr.h"
@@ -346,3 +348,5 @@ split_err:
my_free((gptr) coord_buf, MYF(0));
return err_code;
}
+
+#endif /*HAVE_RTREE_KEYS*/
diff --git a/myisam/rt_test.c b/myisam/rt_test.c
index 41cc56d4d78..5bf390cd0d8 100644
--- a/myisam/rt_test.c
+++ b/myisam/rt_test.c
@@ -19,6 +19,9 @@
#include "myisam.h"
+
+#ifdef HAVE_RTREE_KEYS
+
#include "rt_index.h"
#define MAX_REC_LENGTH 1024
@@ -398,3 +401,10 @@ static void create_record(char *record,uint rownr)
pos+=sizeof(c);
}
}
+
+#else
+int main(int argc __attribute__((unused)),char *argv[] __attribute__((unused)))
+{
+ exit(0);
+}
+#endif /*HAVE_RTREE_KEYS*/
diff --git a/myisam/sp_defs.h b/myisam/sp_defs.h
index 0acefe32f80..4cc2267a1bd 100644
--- a/myisam/sp_defs.h
+++ b/myisam/sp_defs.h
@@ -22,6 +22,8 @@
#define SPTYPE HA_KEYTYPE_DOUBLE
#define SPLEN 8
+#ifdef HAVE_SPATIAL
+
enum wkbType
{
wkbPoint = 1,
@@ -42,4 +44,5 @@ enum wkbByteOrder
uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
const byte *record, my_off_t filepos);
+#endif /*HAVE_SPATIAL*/
#endif /* _SP_DEFS_H */
diff --git a/myisam/sp_key.c b/myisam/sp_key.c
index f669d217026..0e424a9e193 100644
--- a/myisam/sp_key.c
+++ b/myisam/sp_key.c
@@ -15,6 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "myisamdef.h"
+
+#ifdef HAVE_SPATIAL
+
#include "sp_defs.h"
static int sp_add_point_to_mbr(uchar *(*wkb), uchar *end, uint n_dims,
@@ -284,3 +287,5 @@ static int sp_get_geometry_mbr(uchar *(*wkb), uchar *end, uint n_dims,
}
return res;
}
+
+#endif /*HAVE_SPATIAL*/
diff --git a/myisam/sp_test.c b/myisam/sp_test.c
index 29c5f47471a..f0b48dbd5d8 100644
--- a/myisam/sp_test.c
+++ b/myisam/sp_test.c
@@ -18,6 +18,8 @@
/* Written by Alex Barkov, who has a shared copyright to this code */
#include "myisam.h"
+
+#ifdef HAVE_SPATIAL
#include "sp_defs.h"
#define MAX_REC_LENGTH 1024
@@ -553,3 +555,11 @@ static void rtree_PrintWKB(uchar *wkb, uint n_dims)
}
}
}
+
+#else
+int main(int argc __attribute__((unused)),char *argv[] __attribute__((unused)))
+{
+ exit(0);
+}
+#endif /*HAVE_SPATIAL*/
+