[Groonga-mysql-commit] mroonga/mroonga [master] geometry: support building without geometry support

Back to archive index

null+****@clear***** null+****@clear*****
2012年 3月 18日 (日) 15:08:10 JST


Kouhei Sutou	2012-03-18 15:08:10 +0900 (Sun, 18 Mar 2012)

  New Revision: 8bf098685cbc2457fe3109afdad4070923cfab7c

  Log:
    geometry: support building without geometry support
    
    fixes #1313
    
    Reported by Kazuhiko Shiozaki. Thanks!!!

  Modified files:
    ha_mroonga.cc
    test/sql/suite/mroonga_storage/t/alter_table_spatial.test
    test/sql/suite/mroonga_storage/t/geometry_contains.test
    test/sql/suite/mroonga_wrapper/t/alter_table_spatial.test
    test/sql/suite/mroonga_wrapper/t/geometry_contains.test
    test/sql/suite/mroonga_wrapper/t/geometry_delete.test
    test/sql/suite/mroonga_wrapper/t/geometry_update.test

  Modified: ha_mroonga.cc (+6 -0)
===================================================================
--- ha_mroonga.cc    2012-03-18 14:50:40 +0900 (150cbcf)
+++ ha_mroonga.cc    2012-03-18 15:08:10 +0900 (301e06b)
@@ -1098,6 +1098,7 @@ static grn_builtin_type mrn_grn_type_from_field(grn_ctx *ctx, Field *field,
   return type;
 }
 
+#ifdef HAVE_SPATIAL
 static int mrn_set_geometry(grn_ctx *ctx, grn_obj *buf,
                             const char *wkb, uint wkb_size)
 {
@@ -1128,6 +1129,7 @@ static int mrn_set_geometry(grn_ctx *ctx, grn_obj *buf,
 
   return error;
 }
+#endif
 
 #ifdef WORDS_BIGENDIAN
 #define mrn_byte_order_host_to_network(buf, key, size)  \
@@ -8028,11 +8030,13 @@ int ha_mroonga::generic_store_bulk_geometry(Field *field, grn_obj *buf)
 {
   MRN_DBUG_ENTER_METHOD();
   int error = 0;
+#ifdef HAVE_SPATIAL
   String buffer;
   Field_geom *geometry = (Field_geom *)field;
   const char *wkb = geometry->val_str(0, &buffer)->ptr();
   int len = geometry->get_length();
   error = mrn_set_geometry(ctx, buf, wkb, len);
+#endif
   DBUG_RETURN(error);
 }
 
@@ -8337,6 +8341,7 @@ void ha_mroonga::storage_store_field_geometry(Field *field,
                                               uint value_length)
 {
   MRN_DBUG_ENTER_METHOD();
+#ifdef HAVE_SPATIAL
   uchar wkb[SRID_SIZE + WKB_HEADER_SIZE + POINT_DATA_SIZE];
   grn_geo_point *field_value = (grn_geo_point *)value;
   int latitude, longitude;
@@ -8358,6 +8363,7 @@ void ha_mroonga::storage_store_field_geometry(Field *field,
   field->store((const char *)wkb,
                (uint)(sizeof(wkb) / sizeof(*wkb)),
                field->charset());
+#endif
   DBUG_VOID_RETURN;
 }
 

  Modified: test/sql/suite/mroonga_storage/t/alter_table_spatial.test (+1 -0)
===================================================================
--- test/sql/suite/mroonga_storage/t/alter_table_spatial.test    2012-03-18 14:50:40 +0900 (790d1e2)
+++ test/sql/suite/mroonga_storage/t/alter_table_spatial.test    2012-03-18 15:08:10 +0900 (7769a80)
@@ -15,6 +15,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 --source include/not_embedded.inc
+--source include/have_geometry.inc
 --source include/have_mroonga.inc
 
 --disable_warnings

  Modified: test/sql/suite/mroonga_storage/t/geometry_contains.test (+1 -0)
===================================================================
--- test/sql/suite/mroonga_storage/t/geometry_contains.test    2012-03-18 14:50:40 +0900 (deb49e3)
+++ test/sql/suite/mroonga_storage/t/geometry_contains.test    2012-03-18 15:08:10 +0900 (47a5812)
@@ -14,6 +14,7 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
+--source include/have_geometry.inc
 --source include/have_mroonga.inc
 
 --disable_warnings

  Modified: test/sql/suite/mroonga_wrapper/t/alter_table_spatial.test (+1 -0)
===================================================================
--- test/sql/suite/mroonga_wrapper/t/alter_table_spatial.test    2012-03-18 14:50:40 +0900 (359f1d9)
+++ test/sql/suite/mroonga_wrapper/t/alter_table_spatial.test    2012-03-18 15:08:10 +0900 (43d7768)
@@ -16,6 +16,7 @@
 
 --source include/have_innodb.inc
 --source include/not_embedded.inc
+--source include/have_geometry.inc
 --source include/have_mroonga.inc
 
 --disable_warnings

  Modified: test/sql/suite/mroonga_wrapper/t/geometry_contains.test (+1 -0)
===================================================================
--- test/sql/suite/mroonga_wrapper/t/geometry_contains.test    2012-03-18 14:50:40 +0900 (bba8320)
+++ test/sql/suite/mroonga_wrapper/t/geometry_contains.test    2012-03-18 15:08:10 +0900 (810ba30)
@@ -15,6 +15,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 --source include/have_innodb.inc
+--source include/have_geometry.inc
 --source include/have_mroonga.inc
 
 --disable_warnings

  Modified: test/sql/suite/mroonga_wrapper/t/geometry_delete.test (+1 -0)
===================================================================
--- test/sql/suite/mroonga_wrapper/t/geometry_delete.test    2012-03-18 14:50:40 +0900 (0919ba7)
+++ test/sql/suite/mroonga_wrapper/t/geometry_delete.test    2012-03-18 15:08:10 +0900 (5b0f358)
@@ -15,6 +15,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 --source include/have_innodb.inc
+--source include/have_geometry.inc
 --source include/have_mroonga.inc
 
 --disable_warnings

  Modified: test/sql/suite/mroonga_wrapper/t/geometry_update.test (+1 -0)
===================================================================
--- test/sql/suite/mroonga_wrapper/t/geometry_update.test    2012-03-18 14:50:40 +0900 (bd56755)
+++ test/sql/suite/mroonga_wrapper/t/geometry_update.test    2012-03-18 15:08:10 +0900 (0d329ae)
@@ -15,6 +15,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 --source include/have_innodb.inc
+--source include/have_geometry.inc
 --source include/have_mroonga.inc
 
 --disable_warnings




Groonga-mysql-commit メーリングリストの案内
Back to archive index