summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--myisam/mi_create.c7
-rw-r--r--myisam/mi_key.c2
-rw-r--r--myisam/mi_open.c7
-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
-rw-r--r--sql/spatial.cc4
-rw-r--r--sql/spatial.h3
-rw-r--r--sql/sql_yacc.yy8
21 files changed, 86 insertions, 9 deletions
diff --git a/myisam/mi_create.c b/myisam/mi_create.c
index 72633966b54..aef19ad8660 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)
@@ -582,6 +587,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;
@@ -597,6 +603,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..b53d66b59aa 100644
--- a/myisam/mi_key.c
+++ b/myisam/mi_key.c
@@ -46,7 +46,9 @@ 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);
+#endif
}
start=key;
diff --git a/myisam/mi_open.c b/myisam/mi_open.c
index 2c4661c4d3e..be3db2dc7ac 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,10 @@ 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;
+#endif
}
else
{
diff --git a/myisam/mi_range.c b/myisam/mi_range.c
index caa57ce6187..32355d3894b 100644
--- a/myisam/mi_range.c
+++ b/myisam/mi_range.c
@@ -53,6 +53,7 @@ ha_rows mi_records_in_range(MI_INFO *info, int inx, const byte *start_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;
@@ -65,6 +66,7 @@ ha_rows mi_records_in_range(MI_INFO *info, int inx, const byte *start_key,
res=res?res:1;
break;
}
+#endif
case HA_KEY_ALG_BTREE:
default:
start_pos= (start_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 e1cf916d6d9..3e87785154d 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,
@@ -59,6 +61,7 @@ int mi_rnext(MI_INFO *info, byte *buf, int inx)
{
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
@@ -67,7 +70,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 bbeb8fce2d1..ecf7b411511 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
@@ -419,3 +422,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 5cbf5e87579..82a7823f624 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
@@ -575,3 +577,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*/
+
diff --git a/sql/spatial.cc b/sql/spatial.cc
index f98799e26d1..a08a1508ecc 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -15,6 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mysql_priv.h"
+
+#ifdef HAVE_SPATIAL
+
#define MAX_DIGITS_IN_DOUBLE 16
/***************************** Gis_class_info *******************************/
@@ -1652,3 +1655,4 @@ const Geometry::Class_info *Gis_geometry_collection::get_class_info() const
return &geometrycollection_class;
}
+#endif /*HAVE_SPATIAL*/
diff --git a/sql/spatial.h b/sql/spatial.h
index 5d425725437..b3018668842 100644
--- a/sql/spatial.h
+++ b/sql/spatial.h
@@ -17,6 +17,8 @@
#ifndef _spatial_h
#define _spatial_h
+#ifdef HAVE_SPATIAL
+
const uint SRID_SIZE= 4;
const uint SIZEOF_STORED_DOUBLE= 8;
const uint POINT_DATA_SIZE= SIZEOF_STORED_DOUBLE*2;
@@ -460,4 +462,5 @@ struct Geometry_buffer
void *arr[(geometry_buffer_size - 1)/sizeof(void *) + 1];
};
+#endif /*HAVE_SPATAIAL*/
#endif
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index f317219bd38..2b960423526 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1303,7 +1303,6 @@ type:
$$=FIELD_TYPE_GEOMETRY;
#else
net_printf(Lex->thd, ER_FEATURE_DISABLED,
- ER(ER_FEATURE_DISABLED),
sym_group_geom.name,
sym_group_geom.needed_define);
YYABORT;
@@ -1595,7 +1594,6 @@ key_type:
$$= Key::SPATIAL;
#else
net_printf(Lex->thd, ER_FEATURE_DISABLED,
- ER(ER_FEATURE_DISABLED),
sym_group_geom.name, sym_group_geom.needed_define);
YYABORT;
#endif
@@ -1629,7 +1627,6 @@ opt_unique_or_fulltext:
$$= Key::SPATIAL;
#else
net_printf(Lex->thd, ER_FEATURE_DISABLED,
- ER(ER_FEATURE_DISABLED),
sym_group_geom.name, sym_group_geom.needed_define);
YYABORT;
#endif
@@ -2582,7 +2579,6 @@ simple_expr:
if (!$1.symbol->create_func)
{
net_printf(Lex->thd, ER_FEATURE_DISABLED,
- ER(ER_FEATURE_DISABLED),
$1.symbol->group->name,
$1.symbol->group->needed_define);
YYABORT;
@@ -2594,7 +2590,6 @@ simple_expr:
if (!$1.symbol->create_func)
{
net_printf(Lex->thd, ER_FEATURE_DISABLED,
- ER(ER_FEATURE_DISABLED),
$1.symbol->group->name,
$1.symbol->group->needed_define);
YYABORT;
@@ -2606,7 +2601,6 @@ simple_expr:
if (!$1.symbol->create_func)
{
net_printf(Lex->thd, ER_FEATURE_DISABLED,
- ER(ER_FEATURE_DISABLED),
$1.symbol->group->name,
$1.symbol->group->needed_define);
YYABORT;
@@ -2618,7 +2612,6 @@ simple_expr:
if (!$1.symbol->create_func)
{
net_printf(Lex->thd, ER_FEATURE_DISABLED,
- ER(ER_FEATURE_DISABLED),
$1.symbol->group->name,
$1.symbol->group->needed_define);
YYABORT;
@@ -2713,7 +2706,6 @@ simple_expr:
$$= $1;
#else
net_printf(Lex->thd, ER_FEATURE_DISABLED,
- ER(ER_FEATURE_DISABLED),
sym_group_geom.name, sym_group_geom.needed_define);
YYABORT;
#endif