[Groonga-mysql-commit] mroonga/mroonga [fix-for-visual-studio] [storage] use independent result table for geometory search.

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Oct 4 10:40:27 JST 2012


Kouhei Sutou	2011-09-24 23:24:53 +0900 (Sat, 24 Sep 2011)

  New Revision: 5faaf8539060e639428c132c5a4c1554ed13774e
  https://github.com/mroonga/mroonga/commit/5faaf8539060e639428c132c5a4c1554ed13774e

  Log:
    [storage] use independent result table for geometory search.

  Modified files:
    ha_mroonga.cc
    ha_mroonga.h

  Modified: ha_mroonga.cc (+10 -5)
===================================================================
--- ha_mroonga.cc    2011-09-24 23:11:00 +0900 (89e7ca5)
+++ ha_mroonga.cc    2011-09-24 23:24:53 +0900 (e1a4b9f)
@@ -1173,6 +1173,7 @@ ha_mroonga::ha_mroonga(handlerton *hton, TABLE_SHARE *share)
   index_table_cursor = NULL;
   result = NULL;
   result0 = NULL;
+  result_geo = NULL;
   score_column = NULL;
   share = NULL;
   is_clone = FALSE;
@@ -4176,10 +4177,10 @@ int ha_mroonga::storage_index_read_map_geo(uchar *buf, const uchar *key,
   int error = 0;
   int flags = 0;
   if (find_flag & HA_READ_MBR_CONTAIN) {
-    result = storage_geo_select_in_rectangle(grn_index_columns[active_index],
-                                             key);
+    result_geo = storage_geo_select_in_rectangle(grn_index_columns[active_index],
+                                                 key);
     // TODO: check result
-    cursor = grn_table_cursor_open(ctx, result, NULL, 0, NULL, 0,
+    cursor = grn_table_cursor_open(ctx, result_geo, NULL, 0, NULL, 0,
                                    0, -1, flags);
   } else {
     push_warning_unsupported_spatial_index_search(find_flag);
@@ -5184,6 +5185,10 @@ void ha_mroonga::clear_search_result()
     grn_obj_unlink(ctx, result);
     result = NULL;
   }
+  if (result_geo) {
+    grn_obj_unlink(ctx, result_geo);
+    result_geo = NULL;
+  }
   DBUG_VOID_RETURN;
 }
 
@@ -5197,9 +5202,9 @@ int ha_mroonga::storage_get_next_record(uchar *buf)
     clear_search_result();
     DBUG_RETURN(error);
   }
-  if (result && record_id) {
+  if (result_geo && record_id) {
     grn_id real_record_id;
-    if (grn_table_get_key(ctx, result, record_id,
+    if (grn_table_get_key(ctx, result_geo, record_id,
                           &real_record_id, sizeof(real_record_id))) {
       record_id = real_record_id;
     } else {

  Modified: ha_mroonga.h (+1 -0)
===================================================================
--- ha_mroonga.h    2011-09-24 23:11:00 +0900 (f24cc90)
+++ ha_mroonga.h    2011-09-24 23:24:53 +0900 (4254fcf)
@@ -129,6 +129,7 @@ private:
 
   grn_obj *result;
   grn_obj *result0;
+  grn_obj *result_geo;
   grn_table_cursor *cursor;
   grn_table_cursor *index_table_cursor;
   grn_id record_id;
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-mysql-commit mailing list
Back to archive index