[Groonga-commit] groonga/groonga [master] Disable function call in output_columns by default

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Oct 24 19:08:51 JST 2012


Kouhei Sutou	2012-10-24 19:08:51 +0900 (Wed, 24 Oct 2012)

  New Revision: 7213eee59c7813bd135efdb05e03db939145675e
  https://github.com/groonga/groonga/commit/7213eee59c7813bd135efdb05e03db939145675e

  Log:
    Disable function call in output_columns by default
    
    Because it is experimental feature.
    You can enable it by specifying --command_version 2 explicitly.
    
    The "--command_version 2" switch will be removed when this feature is
    marked as stable.

  Modified files:
    lib/proc.c
    test/command/suite/select/output_columns/function_call.expected
    test/command/suite/select/output_columns/function_call.test

  Modified: lib/proc.c (+10 -3)
===================================================================
--- lib/proc.c    2012-10-25 13:14:06 +0900 (a8c6579)
+++ lib/proc.c    2012-10-24 19:08:51 +0900 (9d62c29)
@@ -409,11 +409,18 @@ grn_parse_query_flags(grn_ctx *ctx, const char *query_flags,
 }
 
 static inline grn_bool
-is_output_columns_format_v1(const char *output_columns,
+is_output_columns_format_v1(grn_ctx *ctx,
+                            const char *output_columns,
                             unsigned int output_columns_len)
 {
   unsigned int i;
 
+  /* TODO: REMOVE ME. If new output_columns handler is marked as stable,
+     this check is removed. We need more error checks. */
+  if (grn_ctx_get_command_version(ctx) == GRN_COMMAND_VERSION_1) {
+    return GRN_TRUE;
+  }
+
   for (i = 0; i < output_columns_len; i++) {
     switch (output_columns[i]) {
     case ',' :
@@ -635,7 +642,7 @@ grn_select(grn_ctx *ctx, const char *table, unsigned int table_len,
           format.flags =
             GRN_OBJ_FORMAT_WITH_COLUMN_NAMES|
             GRN_OBJ_FORMAT_XML_ELEMENT_RESULTSET;
-          if (is_output_columns_format_v1(output_columns, output_columns_len)) {
+          if (is_output_columns_format_v1(ctx, output_columns, output_columns_len)) {
             grn_obj_columns(ctx, sorted, output_columns, output_columns_len,
                             &format.columns);
           } else {
@@ -657,7 +664,7 @@ grn_select(grn_ctx *ctx, const char *table, unsigned int table_len,
           format.flags =
             GRN_OBJ_FORMAT_WITH_COLUMN_NAMES|
             GRN_OBJ_FORMAT_XML_ELEMENT_RESULTSET;
-          if (is_output_columns_format_v1(output_columns, output_columns_len)) {
+          if (is_output_columns_format_v1(ctx, output_columns, output_columns_len)) {
             grn_obj_columns(ctx, res, output_columns, output_columns_len,
                             &format.columns);
           } else {

  Modified: test/command/suite/select/output_columns/function_call.expected (+1 -1)
===================================================================
--- test/command/suite/select/output_columns/function_call.expected    2012-10-25 13:14:06 +0900 (c424ddc)
+++ test/command/suite/select/output_columns/function_call.expected    2012-10-24 19:08:51 +0900 (dd2c4ce)
@@ -7,7 +7,7 @@ load --table Users
 {"_key": "alice", "name": "Alice"}
 ]
 [[0,0.0,0.0],1]
-select Users --output_columns '_key, name, edit_distance(name, "alice")'
+select Users   --output_columns '_key, name, edit_distance(name, "alice")'   --command_version 2
 [
   [
     0,

  Modified: test/command/suite/select/output_columns/function_call.test (+3 -1)
===================================================================
--- test/command/suite/select/output_columns/function_call.test    2012-10-25 13:14:06 +0900 (62f32d6)
+++ test/command/suite/select/output_columns/function_call.test    2012-10-24 19:08:51 +0900 (7ed5722)
@@ -6,4 +6,6 @@ load --table Users
 {"_key": "alice", "name": "Alice"}
 ]
 
-select Users --output_columns '_key, name, edit_distance(name, "alice")'
+select Users \
+  --output_columns '_key, name, edit_distance(name, "alice")' \
+  --command_version 2
-------------- next part --------------
HTML����������������������������...
Download 



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