[Groonga-commit] groonga/groonga at 4e2bd9d [master] select: extract output code

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Sun May 22 17:15:14 JST 2016


Kouhei Sutou	2016-05-22 17:15:14 +0900 (Sun, 22 May 2016)

  New Revision: 4e2bd9d7f379b9bc00ad242cf1620019e8162fc6
  https://github.com/groonga/groonga/commit/4e2bd9d7f379b9bc00ad242cf1620019e8162fc6

  Message:
    select: extract output code

  Modified files:
    lib/proc/proc_select.c

  Modified: lib/proc/proc_select.c (+30 -21)
===================================================================
--- lib/proc/proc_select.c    2016-05-22 16:50:24 +0900 (fe709fc)
+++ lib/proc/proc_select.c    2016-05-22 17:15:14 +0900 (ef1e8ca)
@@ -1434,6 +1434,34 @@ grn_select_sort(grn_ctx *ctx,
 }
 
 static grn_bool
+grn_select_output(grn_ctx *ctx,
+                  grn_select_data *data)
+{
+  int offset;
+  grn_obj *output_table;
+
+  if (data->tables.sorted) {
+    offset = 0;
+    output_table = data->tables.sorted;
+  } else {
+    offset = data->offset;
+    output_table = data->tables.result;
+  }
+  grn_proc_select_output_columns(ctx,
+                                 output_table,
+                                 grn_table_size(ctx, data->tables.result),
+                                 offset,
+                                 data->limit,
+                                 data->output_columns.value,
+                                 data->output_columns.length,
+                                 data->condition.expression);
+  GRN_QUERY_LOG(ctx, GRN_QUERY_LOG_SIZE,
+                ":", "output(%d)", data->limit);
+
+  return GRN_TRUE;
+}
+
+static grn_bool
 grn_select_prepare_slices(grn_ctx *ctx,
                           grn_select_data *data)
 {
@@ -2443,28 +2471,9 @@ grn_select(grn_ctx *ctx, grn_select_data *data)
 
       GRN_OUTPUT_ARRAY_OPEN("RESULT", data->output.n_elements);
 
-      {
-        int offset;
-        grn_obj *output_table;
-
-        if (data->tables.sorted) {
-          offset = 0;
-          output_table = data->tables.sorted;
-        } else {
-          offset = data->offset;
-          output_table = data->tables.result;
-        }
-        grn_proc_select_output_columns(ctx,
-                                       output_table,
-                                       nhits,
-                                       offset,
-                                       data->limit,
-                                       data->output_columns.value,
-                                       data->output_columns.length,
-                                       data->condition.expression);
+      if (!grn_select_output(ctx, data)) {
+        goto exit;
       }
-      GRN_QUERY_LOG(ctx, GRN_QUERY_LOG_SIZE,
-                    ":", "output(%d)", data->limit);
       if (!ctx->rc) {
         if (data->slices) {
           grn_select_slices(ctx, data, data->tables.result, data->slices);
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る