Skip to content

Commit 6dcda51

Browse files
author
hf@deer.(none)
committed
SCRUM:
WL#1163 (Making spatial code optional) Pack of changes to do in sql/ code.
1 parent ecf8118 commit 6dcda51

File tree

12 files changed

+919
-736
lines changed

12 files changed

+919
-736
lines changed

sql/field.cc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4470,7 +4470,7 @@ Field_blob::Field_blob(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
44704470
:Field_str(ptr_arg, (1L << min(blob_pack_length,3)*8)-1L,
44714471
null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg,
44724472
table_arg, cs),
4473-
geom_flag(true), packlength(blob_pack_length)
4473+
packlength(blob_pack_length)
44744474
{
44754475
flags|= BLOB_FLAG;
44764476
if (table)
@@ -4705,6 +4705,7 @@ void Field_blob::get_key_image(char *buff,uint length,
47054705
uint32 blob_length= get_length(ptr);
47064706
char *blob;
47074707

4708+
#ifdef HAVE_SPATIAL
47084709
if (type == itMBR)
47094710
{
47104711
if (!blob_length)
@@ -4721,6 +4722,7 @@ void Field_blob::get_key_image(char *buff,uint length,
47214722
float8store(buff+24, mbr.ymax);
47224723
return;
47234724
}
4725+
#endif /*HAVE_SPATIAL*/
47244726

47254727
if ((uint32) length > blob_length)
47264728
{
@@ -4930,6 +4932,7 @@ uint Field_blob::max_packed_col_length(uint max_length)
49304932
return (max_length > 255 ? 2 : 1)+max_length;
49314933
}
49324934

4935+
#ifdef HAVE_SPATIAL
49334936

49344937
void Field_geom::get_key_image(char *buff, uint length, CHARSET_INFO *cs,
49354938
imagetype type)
@@ -5013,6 +5016,7 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
50135016
return 0;
50145017
}
50155018

5019+
#endif /*HAVE_SPATIAL*/
50165020

50175021
/****************************************************************************
50185022
** enum type.
@@ -5488,10 +5492,12 @@ Field *make_field(char *ptr, uint32 field_length,
54885492
f_packtype(pack_flag),
54895493
field_length);
54905494

5495+
#ifdef HAVE_SPATIAL
54915496
if (f_is_geom(pack_flag))
54925497
return new Field_geom(ptr,null_pos,null_bit,
54935498
unireg_check, field_name, table,
54945499
pack_length, geom_type);
5500+
#endif
54955501
if (f_is_blob(pack_flag))
54965502
return new Field_blob(ptr,null_pos,null_bit,
54975503
unireg_check, field_name, table,
@@ -5651,10 +5657,12 @@ create_field::create_field(Field *old_field,Field *orig_field)
56515657
def=new Item_string(pos,tmp.length(), charset);
56525658
}
56535659
}
5660+
#ifdef HAVE_SPATIAL
56545661
if (sql_type == FIELD_TYPE_GEOMETRY)
56555662
{
56565663
geom_type= ((Field_geom*)old_field)->geom_type;
56575664
}
5665+
#endif
56585666
}
56595667

56605668

sql/field.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,6 @@ class Field_varstring :public Field_str {
913913

914914

915915
class Field_blob :public Field_str {
916-
bool geom_flag;
917916
protected:
918917
uint packlength;
919918
String value; // For temporaries
@@ -926,7 +925,7 @@ class Field_blob :public Field_str {
926925
struct st_table *table_arg, CHARSET_INFO *cs)
927926
:Field_str((char*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0,0,
928927
NONE, field_name_arg, table_arg, cs),
929-
geom_flag(true), packlength(4)
928+
packlength(4)
930929
{
931930
flags|= BLOB_FLAG;
932931
}
@@ -1001,7 +1000,7 @@ class Field_blob :public Field_str {
10011000
field_cast_enum field_cast_type() { return FIELD_CAST_BLOB; }
10021001
};
10031002

1004-
1003+
#ifdef HAVE_SPATIAL
10051004
class Field_geom :public Field_blob {
10061005
public:
10071006
enum geometry_type geom_type;
@@ -1029,7 +1028,7 @@ class Field_geom :public Field_blob {
10291028
void set_key_image(char *buff,uint length, CHARSET_INFO *cs);
10301029
field_cast_enum field_cast_type() { return FIELD_CAST_GEOM; }
10311030
};
1032-
1031+
#endif /*HAVE_SPATIAL*/
10331032

10341033
class Field_enum :public Field_str {
10351034
protected:

sql/item_create.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ Item *create_func_quote(Item* a)
487487
return new Item_func_quote(a);
488488
}
489489

490+
#ifdef HAVE_SPATIAL
490491
Item *create_func_as_wkt(Item *a)
491492
{
492493
return new Item_func_as_wkt(a);
@@ -646,6 +647,7 @@ Item *create_func_point(Item *a, Item *b)
646647
{
647648
return new Item_func_point(a, b);
648649
}
650+
#endif /*HAVE_SPATIAL*/
649651

650652
Item *create_func_crc32(Item* a)
651653
{

sql/item_create.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ Item *create_func_is_free_lock(Item* a);
9999
Item *create_func_is_used_lock(Item* a);
100100
Item *create_func_quote(Item* a);
101101

102+
#ifdef HAVE_SPATIAL
103+
102104
Item *create_func_geometry_from_text(Item *a);
103105
Item *create_func_as_wkt(Item *a);
104106
Item *create_func_as_wkb(Item *a);
@@ -138,6 +140,8 @@ Item *create_func_numgeometries(Item *a);
138140

139141
Item *create_func_point(Item *a, Item *b);
140142

143+
#endif /*HAVE_SPATIAL*/
144+
141145
Item *create_func_compress(Item *a);
142146
Item *create_func_uncompress(Item *a);
143147
Item *create_func_uncompressed_length(Item *a);

sql/item_geofunc.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
/* This file defines all spatial functions */
1919

20+
#ifdef HAVE_SPATIAL
21+
2022
#ifdef __GNUC__
2123
#pragma implementation // gcc: Class implementation
2224
#endif
@@ -651,3 +653,5 @@ longlong Item_func_srid::val_int()
651653
uint32 res= uint4korr(swkb->ptr());
652654
return (longlong) res;
653655
}
656+
657+
#endif /*HAVE_SPATIAL*/

sql/item_geofunc.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
/* This file defines all spatial functions */
1919

20+
#ifdef HAVE_SPATIAL
21+
2022
#ifdef __GNUC__
2123
#pragma interface /* gcc class implementation */
2224
#endif
@@ -338,3 +340,12 @@ class Item_func_srid: public Item_int_func
338340
const char *func_name() const { return "srid"; }
339341
void fix_length_and_dec() { max_length= 10; }
340342
};
343+
344+
#define GEOM_NEW(obj_constructor) new obj_constructor
345+
346+
#else /*HAVE_SPATIAL*/
347+
348+
#define GEOM_NEW(obj_constructor) NULL
349+
350+
#endif
351+

0 commit comments

Comments
 (0)