[Groonga-commit] groonga/groonga at 04ea638 [master] select: run ID resolve code only when it's needed

Back to archive index

Kouhei Sutou null+****@clear*****
Wed May 11 18:06:42 JST 2016


Kouhei Sutou	2016-05-11 18:06:42 +0900 (Wed, 11 May 2016)

  New Revision: 04ea63829bc378f30a2a3cf1478aee412959625a
  https://github.com/groonga/groonga/commit/04ea63829bc378f30a2a3cf1478aee412959625a

  Message:
    select: run ID resolve code only when it's needed

  Modified files:
    lib/proc/proc_select.c

  Modified: lib/proc/proc_select.c (+7 -6)
===================================================================
--- lib/proc/proc_select.c    2016-05-11 18:02:40 +0900 (c739592)
+++ lib/proc/proc_select.c    2016-05-11 18:06:42 +0900 (0a698be)
@@ -487,13 +487,14 @@ grn_select_apply_columns(grn_ctx *ctx,
 
       GRN_RECORD_SET(ctx, record, id);
       value = grn_expr_exec(ctx, expression, 0);
-      if (column_data->sortby.length > 0) {
-        void *buf;
-        grn_table_cursor_get_value(ctx, table_cursor, &buf);
-        id = *((grn_id *)buf);
-      }
       if (value) {
-        grn_obj_set_value(ctx, column, id, value, GRN_OBJ_SET);
+        grn_id target_record_id = id;
+        if (column_data->sortby.length > 0) {
+          void *sorted_table_value;
+          grn_table_cursor_get_value(ctx, table_cursor, &sorted_table_value);
+          target_record_id = *((grn_id *)sorted_table_value);
+        }
+        grn_obj_set_value(ctx, column, target_record_id, value, GRN_OBJ_SET);
       }
     }
 
-------------- next part --------------
HTML����������������������������...
Download 



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