rroonga 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,27 @@
1
1
  h1. NEWS
2
2
 
3
- h2(#2-1-4). 2.1.4: 2013-03-29
3
+ h2(#3-0-1). 3.0.1: 2013-05-01
4
+
5
+ h3. Improvements
6
+
7
+ * Required groonga >= 3.0.3.
8
+ * Supported assigning weight to value. See {Groonga::Table#set_column_value},
9
+ {Groonga::Record#initialize} and {Groonga::Record#[]=} for details.
10
+ * Renamed to {Groonga::QueryLogger.path} from {Groonga::Logger.query_log_path}.
11
+ * Renamed to {Groonga::QueryLogger.path=} from {Groonga::Logger.query_log_path=}.
12
+ * Renamed to {Groonga::Logger.path} from {Groonga::Logger.log_path}.
13
+ * Renamed to {Groonga::Logger.path=} from {Groonga::Logger.log_path=}.
14
+ * Added missing "Packnga >= 0.9.7" requirement. [Reported by takkanm]
15
+
16
+ h3. Fixes
17
+
18
+ * Fixed a memory leak on error.
19
+
20
+ h3. Thanks
21
+
22
+ * takkanm
23
+
24
+ h2(#3-0-0). 3.0.0: 2013-03-29
4
25
 
5
26
  h3. Improvements
6
27
 
@@ -353,7 +353,7 @@ rb_grn_array_push (VALUE self)
353
353
  * p pulled_record.nil? # => true
354
354
  * end
355
355
  *
356
- * @see {Groonga::Array#push} Examples exist in the push documentation.
356
+ * @see Groonga::Array#push Examples exist in the push documentation.
357
357
  *
358
358
  * @overload pull(options={})
359
359
  * @param [::Hash] options The option parameters.
@@ -239,7 +239,7 @@ rb_grn_logger_s_register (int argc, VALUE *argv, VALUE klass)
239
239
 
240
240
  rb_grn_scan_options(rb_options,
241
241
  "max_level", &rb_max_level,
242
- "time", &rb_time,
242
+ "time", &rb_time,
243
243
  "title", &rb_title,
244
244
  "message", &rb_message,
245
245
  "location", &rb_location,
@@ -340,107 +340,65 @@ rb_grn_logger_s_reopen (VALUE klass)
340
340
  }
341
341
 
342
342
  /*
343
- * groongaのデフォルトロガーがログを出力するファイルのパスを返す。
343
+ * Gets the current log path that is used the default logger.
344
344
  *
345
- * @overload log_path
346
- * @return [String]
345
+ * @overload path
346
+ * @return [String or nil] The current log path
347
+ *
348
+ * @since 3.0.1
347
349
  */
348
350
  static VALUE
349
- rb_grn_logger_s_get_log_path (VALUE klass)
351
+ rb_grn_logger_s_get_path (VALUE klass)
350
352
  {
351
353
  const char *path;
354
+ VALUE rb_path = Qnil;
352
355
 
353
356
  path = grn_default_logger_get_path();
354
357
  if (path) {
355
- return rb_str_new2(path);
356
- } else {
357
- return Qnil;
358
+ rb_path = rb_str_new2(path);
358
359
  }
360
+ return rb_path;
359
361
  }
360
362
 
361
363
  /*
362
- * groongaのデフォルトロガーがログを出力するファイルのパスを
363
- * 指定する。
364
+ * Sets the log path that is used the default logger. If you're using
365
+ * custom logger by {.register}, the log path isn't used. Because it
366
+ * is for the default logger.
364
367
  *
365
- * {Groonga::Logger.register} で独自のロガーを設定している場合、
366
- * 設定している独自ロガーは無効になる。
368
+ * If you specify nil as path, logging by the default logger is
369
+ * disabled.
367
370
  *
368
- * @overload log_path=(path)
369
- */
370
- static VALUE
371
- rb_grn_logger_s_set_log_path (VALUE klass, VALUE rb_path)
372
- {
373
- grn_bool need_reopen = GRN_FALSE;
374
- const char *current_path;
375
-
376
- current_path = grn_default_logger_get_path();
377
- if (NIL_P(rb_path)) {
378
- need_reopen = current_path != NULL;
379
- grn_default_logger_set_path(NULL);
380
- } else {
381
- const char *new_path;
382
- new_path = RSTRING_PTR(rb_path);
383
- if (!current_path || strcmp(new_path, current_path) != 0) {
384
- need_reopen = GRN_TRUE;
385
- }
386
- grn_default_logger_set_path(new_path);
387
- }
388
- rb_cv_set(klass, "@@log_path", rb_path);
389
-
390
- if (need_reopen) {
391
- rb_grn_logger_s_reopen_with_related_object(klass, rb_path);
392
- }
393
-
394
- return Qnil;
395
- }
396
-
397
- /*
398
- * groongaのデフォルトロガーがクエリログを出力するファイルのパスを返す。
371
+ * @example Changes the log path for the default logger
372
+ * Groonga::Logger.path = "/tmp/groonga.log"
399
373
  *
400
- * @overload query_log_path
401
- * @return [String]
402
- */
403
- static VALUE
404
- rb_grn_logger_s_get_query_log_path (VALUE klass)
405
- {
406
- const char *path;
407
-
408
- path = grn_default_query_logger_get_path();
409
- if (path) {
410
- return rb_str_new2(path);
411
- } else {
412
- return Qnil;
413
- }
414
- }
415
-
416
- /*
417
- * groongaのデフォルトロガーがクエリログを出力するファイルの
418
- * パスを指定する。
374
+ * @example Disables log by the default logger
375
+ * Groonga::Logger.path = nil
419
376
  *
420
- * {Groonga::Logger.register} で独自のロガーを設定している場合、
421
- * 設定している独自ロガーは無効になる。
377
+ * @overload path=(path)
378
+ * @param path [String or nil] The log path for the default logger.
379
+ * If nil is specified, logging by the default logger is disabled.
380
+ * @return void
422
381
  *
423
- * @overload query_log_path=(path)
382
+ * @since 3.0.1
424
383
  */
425
384
  static VALUE
426
- rb_grn_logger_s_set_query_log_path (VALUE klass, VALUE rb_path)
385
+ rb_grn_logger_s_set_path (VALUE klass, VALUE rb_path)
427
386
  {
428
387
  grn_bool need_reopen = GRN_FALSE;
429
- const char *current_path;
388
+ const char *old_path = NULL;
389
+ const char *path = NULL;
430
390
 
431
- current_path = grn_default_query_logger_get_path();
432
- if (NIL_P(rb_path)) {
433
- need_reopen = current_path != NULL;
434
- grn_default_query_logger_set_path(NULL);
435
- } else {
436
- const char *new_path;
437
- new_path = RSTRING_PTR(rb_path);
438
- if (!current_path || strcmp(new_path, current_path) != 0) {
439
- need_reopen = GRN_TRUE;
440
- }
441
- grn_default_query_logger_set_path(new_path);
391
+ rb_path = rb_grn_check_convert_to_string(rb_path);
392
+ if (!NIL_P(rb_path)) {
393
+ path = StringValuePtr(rb_path);
394
+ }
395
+
396
+ old_path = grn_default_logger_get_path();
397
+ if (!rb_grn_equal_string(old_path, path)) {
398
+ need_reopen = GRN_TRUE;
442
399
  }
443
- rb_cv_set(klass, "@@query_log_path", rb_path);
400
+
401
+ grn_default_logger_set_path(path);
444
402
 
445
403
  if (need_reopen) {
446
404
  rb_grn_logger_s_reopen_with_related_object(klass, rb_path);
@@ -467,22 +425,16 @@ rb_grn_init_logger (VALUE mGrn)
467
425
  cGrnLogger = rb_define_class_under(mGrn, "Logger", rb_cObject);
468
426
 
469
427
  rb_cv_set(cGrnLogger, "@@current_logger", Qnil);
470
- rb_cv_set(cGrnLogger, "@@log_path", Qnil);
471
- rb_cv_set(cGrnLogger, "@@query_log_path", Qnil);
472
428
  rb_define_singleton_method(cGrnLogger, "register",
473
429
  rb_grn_logger_s_register, -1);
474
430
  rb_define_singleton_method(cGrnLogger, "unregister",
475
431
  rb_grn_logger_s_unregister, 0);
476
432
  rb_define_singleton_method(cGrnLogger, "reopen",
477
433
  rb_grn_logger_s_reopen, 0);
478
- rb_define_singleton_method(cGrnLogger, "log_path",
479
- rb_grn_logger_s_get_log_path, 0);
480
- rb_define_singleton_method(cGrnLogger, "log_path=",
481
- rb_grn_logger_s_set_log_path, 1);
482
- rb_define_singleton_method(cGrnLogger, "query_log_path",
483
- rb_grn_logger_s_get_query_log_path, 0);
484
- rb_define_singleton_method(cGrnLogger, "query_log_path=",
485
- rb_grn_logger_s_set_query_log_path, 1);
434
+ rb_define_singleton_method(cGrnLogger, "path",
435
+ rb_grn_logger_s_get_path, 0);
436
+ rb_define_singleton_method(cGrnLogger, "path=",
437
+ rb_grn_logger_s_set_path, 1);
486
438
  rb_set_end_proc(rb_grn_logger_reset, cGrnLogger);
487
439
 
488
440
  mGrnLoggerFlags = rb_define_module_under(cGrnLogger, "Flags");
@@ -1302,7 +1302,7 @@ rb_grn_object_set_raw (RbGrnObject *rb_grn_object, grn_id id,
1302
1302
  VALUE exception, rb_values;
1303
1303
 
1304
1304
  context = rb_grn_object->context;
1305
- rb_values = rb_check_array_type(rb_value);
1305
+ rb_values = rb_grn_check_convert_to_array(rb_value);
1306
1306
  if (NIL_P(rb_values)) {
1307
1307
  if (NIL_P(rb_value)) {
1308
1308
  GRN_OBJ_INIT(&value, GRN_BULK, 0, GRN_ID_NIL);
@@ -88,7 +88,7 @@ rb_grn_plugin_s_register (int argc, VALUE *argv, VALUE klass)
88
88
  grn_ctx *context;
89
89
 
90
90
  if (argc >= 1) {
91
- rb_name = rb_check_string_type(argv[0]);
91
+ rb_name = rb_grn_check_convert_to_string(argv[0]);
92
92
  }
93
93
 
94
94
  if (NIL_P(rb_name)) {
@@ -1,6 +1,6 @@
1
1
  /* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
2
  /*
3
- Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
3
+ Copyright (C) 2012-2013 Kouhei Sutou <kou@clear-code.com>
4
4
 
5
5
  This library is free software; you can redistribute it and/or
6
6
  modify it under the terms of the GNU Lesser General Public
@@ -100,7 +100,7 @@ rb_grn_query_logger_fin (grn_ctx *ctx, void *user_data)
100
100
  * @option options [Symbol, String, Integer or nil] :flags (:default)
101
101
  * Flags describe what query log should be logged.
102
102
  *
103
- * @see {QueryLogger::Flags.parse}
103
+ * If @flags@ is String, it is parsed by {QueryLogger::Flags.parse}.
104
104
  *
105
105
  * @return void
106
106
  *
@@ -218,6 +218,75 @@ rb_grn_query_logger_s_reopen (VALUE klass)
218
218
  return Qnil;
219
219
  }
220
220
 
221
+ /*
222
+ * Gets the current query log path that is used the default query logger.
223
+ *
224
+ * @overload path
225
+ * @return [String or nil] The current query log path
226
+ *
227
+ * @since 3.0.1
228
+ */
229
+ static VALUE
230
+ rb_grn_query_logger_s_get_path (VALUE klass)
231
+ {
232
+ const char *path;
233
+ VALUE rb_path = Qnil;
234
+
235
+ path = grn_default_query_logger_get_path();
236
+ if (path) {
237
+ rb_path = rb_str_new2(path);
238
+ }
239
+ return rb_path;
240
+ }
241
+
242
+ /*
243
+ * Sets the query log path that is used the default query logger. If
244
+ * you're using custom query logger by {.register}, the query log path
245
+ * isn't used. Because it is for the default query logger.
246
+ *
247
+ * If you specify nil as path, query logging by the default query
248
+ * logger is disabled.
249
+ *
250
+ * @example Changes the query log path for the default query logger
251
+ * Groonga::QueryLogger.path = "/tmp/query.log"
252
+ *
253
+ * @example Disables query log by the default query logger
254
+ * Groonga::QueryLogger.path = nil
255
+ *
256
+ * @overload path=(path)
257
+ * @param path [String or nil] The query log path for the default query
258
+ * logger. If nil is specified, query logging by the default query logger
259
+ * is disabled.
260
+ * @return void
261
+ *
262
+ * @since 3.0.1
263
+ */
264
+ static VALUE
265
+ rb_grn_query_logger_s_set_path (VALUE klass, VALUE rb_path)
266
+ {
267
+ grn_bool need_reopen = GRN_FALSE;
268
+ const char *old_path = NULL;
269
+ const char *path = NULL;
270
+
271
+ rb_path = rb_grn_check_convert_to_string(rb_path);
272
+ if (!NIL_P(rb_path)) {
273
+ path = StringValuePtr(rb_path);
274
+ }
275
+
276
+ old_path = grn_default_query_logger_get_path();
277
+ if (!rb_grn_equal_string(old_path, path)) {
278
+ need_reopen = GRN_TRUE;
279
+ }
280
+
281
+ grn_default_query_logger_set_path(path);
282
+
283
+ if (need_reopen) {
284
+ rb_grn_query_logger_s_reopen(klass);
285
+ }
286
+
287
+ return Qnil;
288
+ }
289
+
221
290
  void
222
291
  rb_grn_init_query_logger (VALUE mGrn)
223
292
  {
@@ -242,6 +311,10 @@ rb_grn_init_query_logger (VALUE mGrn)
242
311
  rb_grn_query_logger_s_unregister, 0);
243
312
  rb_define_singleton_method(cGrnQueryLogger, "reopen",
244
313
  rb_grn_query_logger_s_reopen, 0);
314
+ rb_define_singleton_method(cGrnQueryLogger, "path",
315
+ rb_grn_query_logger_s_get_path, 0);
316
+ rb_define_singleton_method(cGrnQueryLogger, "path=",
317
+ rb_grn_query_logger_s_set_path, 1);
245
318
 
246
319
  mGrnQueryLoggerFlags = rb_define_module_under(cGrnQueryLogger, "Flags");
247
320
  #define DEFINE_FLAG(NAME) \
@@ -43,9 +43,9 @@ grn_obj *
43
43
  rb_grn_table_from_ruby_object (VALUE object, grn_ctx **context)
44
44
  {
45
45
  if (!RVAL2CBOOL(rb_obj_is_kind_of(object, rb_cGrnTable))) {
46
- rb_raise(rb_eTypeError,
47
- "not a groonga table: <%s>",
48
- rb_grn_inspect(object));
46
+ rb_raise(rb_eTypeError,
47
+ "not a groonga table: <%s>",
48
+ rb_grn_inspect(object));
49
49
  }
50
50
 
51
51
  return RVAL2GRNOBJECT(object, context);
@@ -53,7 +53,7 @@ rb_grn_table_from_ruby_object (VALUE object, grn_ctx **context)
53
53
 
54
54
  VALUE
55
55
  rb_grn_table_to_ruby_object (grn_ctx *context, grn_obj *table,
56
- grn_bool owner)
56
+ grn_bool owner)
57
57
  {
58
58
  return GRNOBJECT2RVAL(Qnil, context, table, owner);
59
59
  }
@@ -70,39 +70,39 @@ rb_grn_table_finalizer (grn_ctx *context, grn_obj *object,
70
70
 
71
71
  void
72
72
  rb_grn_table_bind (RbGrnTable *rb_grn_table,
73
- grn_ctx *context, grn_obj *table)
73
+ grn_ctx *context, grn_obj *table)
74
74
  {
75
75
  RbGrnObject *rb_grn_object;
76
76
 
77
77
  rb_grn_object = RB_GRN_OBJECT(rb_grn_table);
78
78
  rb_grn_table->value = grn_obj_open(context, GRN_BULK, 0,
79
- rb_grn_object->range_id);
79
+ rb_grn_object->range_id);
80
80
  rb_grn_table->columns = Qnil;
81
81
  rb_grn_table->columns = rb_ary_new();
82
82
  }
83
83
 
84
84
  void
85
85
  rb_grn_table_deconstruct (RbGrnTable *rb_grn_table,
86
- grn_obj **table,
87
- grn_ctx **context,
88
- grn_id *domain_id,
89
- grn_obj **domain,
90
- grn_obj **value,
91
- grn_id *range_id,
92
- grn_obj **range,
93
- VALUE *columns)
86
+ grn_obj **table,
87
+ grn_ctx **context,
88
+ grn_id *domain_id,
89
+ grn_obj **domain,
90
+ grn_obj **value,
91
+ grn_id *range_id,
92
+ grn_obj **range,
93
+ VALUE *columns)
94
94
  {
95
95
  RbGrnObject *rb_grn_object;
96
96
 
97
97
  rb_grn_object = RB_GRN_OBJECT(rb_grn_table);
98
98
  rb_grn_object_deconstruct(rb_grn_object, table, context,
99
- domain_id, domain,
100
- range_id, range);
99
+ domain_id, domain,
100
+ range_id, range);
101
101
 
102
102
  if (value)
103
- *value = rb_grn_table->value;
103
+ *value = rb_grn_table->value;
104
104
  if (columns)
105
- *columns = rb_grn_table->columns;
105
+ *columns = rb_grn_table->columns;
106
106
  }
107
107
 
108
108
  static void
@@ -114,23 +114,23 @@ rb_grn_table_mark (void *data)
114
114
  grn_obj *table;
115
115
 
116
116
  if (!rb_grn_object)
117
- return;
117
+ return;
118
118
 
119
119
  rb_gc_mark(rb_grn_table->columns);
120
120
 
121
121
  context = rb_grn_object->context;
122
122
  table = rb_grn_object->object;
123
123
  if (!context || !table)
124
- return;
124
+ return;
125
125
 
126
126
  rb_grn_context_mark_grn_id(context, table->header.domain);
127
127
  rb_grn_context_mark_grn_id(context, grn_obj_get_range(context, table));
128
128
 
129
129
  if (!grn_obj_path(context, table))
130
- return;
130
+ return;
131
131
 
132
132
  if (grn_obj_name(context, table, NULL, 0) == 0)
133
- return;
133
+ return;
134
134
  }
135
135
 
136
136
  static VALUE
@@ -156,24 +156,24 @@ rb_grn_table_inspect_content (VALUE self, VALUE inspected)
156
156
 
157
157
  rb_grn_table = SELF(self);
158
158
  if (!rb_grn_table)
159
- return inspected;
159
+ return inspected;
160
160
 
161
161
  rb_grn_table_deconstruct(rb_grn_table, &table, &context,
162
- NULL, NULL,
163
- NULL, NULL, NULL,
164
- &columns);
162
+ NULL, NULL,
163
+ NULL, NULL, NULL,
164
+ &columns);
165
165
 
166
166
  if (!table)
167
- return inspected;
167
+ return inspected;
168
168
  if (!context)
169
- return inspected;
169
+ return inspected;
170
170
 
171
171
  rb_str_cat2(inspected, ", ");
172
172
  rb_str_cat2(inspected, "size: <");
173
173
  {
174
- char buf[21]; /* ceil(log10(2 ** 64)) + 1('\0') == 21 */
175
- snprintf(buf, sizeof(buf), "%u", grn_table_size(context, table));
176
- rb_str_cat2(inspected, buf);
174
+ char buf[21]; /* ceil(log10(2 ** 64)) + 1('\0') == 21 */
175
+ snprintf(buf, sizeof(buf), "%u", grn_table_size(context, table));
176
+ rb_str_cat2(inspected, buf);
177
177
  }
178
178
  rb_str_cat2(inspected, ">");
179
179
 
@@ -249,9 +249,9 @@ rb_grn_table_define_column (int argc, VALUE *argv, VALUE self)
249
249
  VALUE rb_column;
250
250
 
251
251
  rb_grn_table_deconstruct(SELF(self), &table, &context,
252
- NULL, NULL,
253
- NULL, NULL, NULL,
254
- &columns);
252
+ NULL, NULL,
253
+ NULL, NULL, NULL,
254
+ &columns);
255
255
 
256
256
  rb_scan_args(argc, argv, "21", &rb_name, &rb_value_type, &options);
257
257
 
@@ -259,64 +259,64 @@ rb_grn_table_define_column (int argc, VALUE *argv, VALUE self)
259
259
  name_size = RSTRING_LEN(rb_name);
260
260
 
261
261
  rb_grn_scan_options(options,
262
- "path", &rb_path,
263
- "persistent", &rb_persistent,
264
- "type", &rb_type,
265
- "compress", &rb_compress,
266
- NULL);
262
+ "path", &rb_path,
263
+ "persistent", &rb_persistent,
264
+ "type", &rb_type,
265
+ "compress", &rb_compress,
266
+ NULL);
267
267
 
268
268
  value_type = RVAL2GRNOBJECT(rb_value_type, &context);
269
269
 
270
270
  if ((NIL_P(rb_persistent) && grn_obj_path(context, table)) ||
271
- RVAL2CBOOL(rb_persistent)) {
272
- flags |= GRN_OBJ_PERSISTENT;
271
+ RVAL2CBOOL(rb_persistent)) {
272
+ flags |= GRN_OBJ_PERSISTENT;
273
273
  }
274
274
 
275
275
  if (!NIL_P(rb_path)) {
276
- path = StringValueCStr(rb_path);
277
- if ((flags & GRN_OBJ_PERSISTENT) != GRN_OBJ_PERSISTENT) {
278
- rb_raise(rb_eArgError,
279
- "should not pass :path if :persistent is false: <%s>",
280
- path);
281
- }
282
- flags |= GRN_OBJ_PERSISTENT;
276
+ path = StringValueCStr(rb_path);
277
+ if ((flags & GRN_OBJ_PERSISTENT) != GRN_OBJ_PERSISTENT) {
278
+ rb_raise(rb_eArgError,
279
+ "should not pass :path if :persistent is false: <%s>",
280
+ path);
281
+ }
282
+ flags |= GRN_OBJ_PERSISTENT;
283
283
  }
284
284
 
285
285
  if (NIL_P(rb_type) ||
286
- (rb_grn_equal_option(rb_type, "scalar"))) {
287
- flags |= GRN_OBJ_COLUMN_SCALAR;
286
+ (rb_grn_equal_option(rb_type, "scalar"))) {
287
+ flags |= GRN_OBJ_COLUMN_SCALAR;
288
288
  } else if (rb_grn_equal_option(rb_type, "vector")) {
289
- flags |= GRN_OBJ_COLUMN_VECTOR;
289
+ flags |= GRN_OBJ_COLUMN_VECTOR;
290
290
  } else {
291
- rb_raise(rb_eArgError,
292
- "invalid column type: %s: "
293
- "available types: [:scalar, :vector, nil]",
294
- rb_grn_inspect(rb_type));
291
+ rb_raise(rb_eArgError,
292
+ "invalid column type: %s: "
293
+ "available types: [:scalar, :vector, nil]",
294
+ rb_grn_inspect(rb_type));
295
295
  }
296
296
 
297
297
  if (NIL_P(rb_compress)) {
298
298
  } else if (rb_grn_equal_option(rb_compress, "zlib")) {
299
- flags |= GRN_OBJ_COMPRESS_ZLIB;
299
+ flags |= GRN_OBJ_COMPRESS_ZLIB;
300
300
  } else if (rb_grn_equal_option(rb_compress, "lzo")) {
301
- flags |= GRN_OBJ_COMPRESS_LZO;
301
+ flags |= GRN_OBJ_COMPRESS_LZO;
302
302
  } else {
303
- rb_raise(rb_eArgError,
304
- "invalid compress type: %s: "
305
- "available types: [:zlib, :lzo, nil]",
306
- rb_grn_inspect(rb_compress));
303
+ rb_raise(rb_eArgError,
304
+ "invalid compress type: %s: "
305
+ "available types: [:zlib, :lzo, nil]",
306
+ rb_grn_inspect(rb_compress));
307
307
  }
308
308
 
309
309
  column = grn_column_create(context, table, name, name_size,
310
- path, flags, value_type);
310
+ path, flags, value_type);
311
311
  if (context->rc) {
312
- rb_grn_context_check(context,
313
- rb_ary_new3(2, self, rb_ary_new4(argc, argv)));
312
+ rb_grn_context_check(context,
313
+ rb_ary_new3(2, self, rb_ary_new4(argc, argv)));
314
314
  }
315
315
 
316
316
  rb_column = GRNCOLUMN2RVAL(Qnil, context, column, GRN_TRUE);
317
317
  rb_ary_push(columns, rb_column);
318
318
  rb_grn_named_object_set_name(RB_GRN_NAMED_OBJECT(DATA_PTR(rb_column)),
319
- name, name_size);
319
+ name, name_size);
320
320
 
321
321
  return rb_column;
322
322
  }
@@ -328,17 +328,17 @@ n_gram_tokenizer_p(grn_ctx *context, grn_obj *tokenizer)
328
328
  int name_size;
329
329
 
330
330
  name_size = grn_obj_name(context, tokenizer,
331
- tokenizer_name, sizeof(tokenizer_name) - 1);
331
+ tokenizer_name, sizeof(tokenizer_name) - 1);
332
332
  if (name_size == 0)
333
- return GRN_FALSE;
333
+ return GRN_FALSE;
334
334
 
335
335
  tokenizer_name[name_size] = '\0';
336
336
 
337
337
  #define HAVE_PREFIX_P(prefix) \
338
338
  (strncmp(tokenizer_name, prefix, strlen(prefix)) == 0)
339
339
  return (HAVE_PREFIX_P("TokenUnigram") ||
340
- HAVE_PREFIX_P("TokenBigram") ||
341
- HAVE_PREFIX_P("TokenTrigram"));
340
+ HAVE_PREFIX_P("TokenBigram") ||
341
+ HAVE_PREFIX_P("TokenTrigram"));
342
342
  #undef HAVE_PREFIX_P
343
343
  }
344
344
 
@@ -384,9 +384,9 @@ rb_grn_table_define_index_column (int argc, VALUE *argv, VALUE self)
384
384
  VALUE columns;
385
385
 
386
386
  rb_grn_table_deconstruct(SELF(self), &table, &context,
387
- NULL, NULL,
388
- NULL, NULL, NULL,
389
- &columns);
387
+ NULL, NULL,
388
+ NULL, NULL, NULL,
389
+ &columns);
390
390
 
391
391
  rb_scan_args(argc, argv, "21", &rb_name, &rb_value_type, &options);
392
392
 
@@ -394,100 +394,100 @@ rb_grn_table_define_index_column (int argc, VALUE *argv, VALUE self)
394
394
  name_size = RSTRING_LEN(rb_name);
395
395
 
396
396
  rb_grn_scan_options(options,
397
- "path", &rb_path,
398
- "persistent", &rb_persistent,
399
- "with_section", &rb_with_section,
400
- "with_weight", &rb_with_weight,
401
- "with_position", &rb_with_position,
402
- "source", &rb_source,
403
- "sources", &rb_sources,
404
- NULL);
397
+ "path", &rb_path,
398
+ "persistent", &rb_persistent,
399
+ "with_section", &rb_with_section,
400
+ "with_weight", &rb_with_weight,
401
+ "with_position", &rb_with_position,
402
+ "source", &rb_source,
403
+ "sources", &rb_sources,
404
+ NULL);
405
405
 
406
406
  value_type = RVAL2GRNOBJECT(rb_value_type, &context);
407
407
 
408
408
  if ((NIL_P(rb_persistent) && grn_obj_path(context, table)) ||
409
- RVAL2CBOOL(rb_persistent)) {
410
- flags |= GRN_OBJ_PERSISTENT;
409
+ RVAL2CBOOL(rb_persistent)) {
410
+ flags |= GRN_OBJ_PERSISTENT;
411
411
  }
412
412
 
413
413
  if (!NIL_P(rb_path)) {
414
- path = StringValueCStr(rb_path);
415
- if ((flags & GRN_OBJ_PERSISTENT) != GRN_OBJ_PERSISTENT) {
416
- rb_raise(rb_eArgError,
417
- "should not pass :path if :persistent is false: <%s>",
418
- path);
419
- }
420
- flags |= GRN_OBJ_PERSISTENT;
414
+ path = StringValueCStr(rb_path);
415
+ if ((flags & GRN_OBJ_PERSISTENT) != GRN_OBJ_PERSISTENT) {
416
+ rb_raise(rb_eArgError,
417
+ "should not pass :path if :persistent is false: <%s>",
418
+ path);
419
+ }
420
+ flags |= GRN_OBJ_PERSISTENT;
421
421
  }
422
422
 
423
423
  if (NIL_P(rb_with_section)) {
424
- if (TYPE(rb_sources) == T_ARRAY && RARRAY_LEN(rb_sources) > 1) {
425
- flags |= GRN_OBJ_WITH_SECTION;
426
- }
424
+ if (TYPE(rb_sources) == T_ARRAY && RARRAY_LEN(rb_sources) > 1) {
425
+ flags |= GRN_OBJ_WITH_SECTION;
426
+ }
427
427
  } else if (RVAL2CBOOL(rb_with_section)) {
428
- flags |= GRN_OBJ_WITH_SECTION;
428
+ flags |= GRN_OBJ_WITH_SECTION;
429
429
  }
430
430
 
431
431
 
432
432
  if (RVAL2CBOOL(rb_with_weight))
433
- flags |= GRN_OBJ_WITH_WEIGHT;
433
+ flags |= GRN_OBJ_WITH_WEIGHT;
434
434
 
435
435
  if (NIL_P(rb_with_position) &&
436
- (table->header.type == GRN_TABLE_HASH_KEY ||
437
- table->header.type == GRN_TABLE_PAT_KEY)) {
438
- grn_obj *tokenizer;
439
-
440
- tokenizer = grn_obj_get_info(context, table,
441
- GRN_INFO_DEFAULT_TOKENIZER,
442
- NULL);
443
- if (tokenizer && n_gram_tokenizer_p(context, tokenizer)) {
444
- rb_with_position = Qtrue;
445
- }
436
+ (table->header.type == GRN_TABLE_HASH_KEY ||
437
+ table->header.type == GRN_TABLE_PAT_KEY)) {
438
+ grn_obj *tokenizer;
439
+
440
+ tokenizer = grn_obj_get_info(context, table,
441
+ GRN_INFO_DEFAULT_TOKENIZER,
442
+ NULL);
443
+ if (tokenizer && n_gram_tokenizer_p(context, tokenizer)) {
444
+ rb_with_position = Qtrue;
445
+ }
446
446
  }
447
447
  if (RVAL2CBOOL(rb_with_position))
448
- flags |= GRN_OBJ_WITH_POSITION;
448
+ flags |= GRN_OBJ_WITH_POSITION;
449
449
 
450
450
  if (!NIL_P(rb_source) && !NIL_P(rb_sources))
451
- rb_raise(rb_eArgError, "should not pass both of :source and :sources.");
451
+ rb_raise(rb_eArgError, "should not pass both of :source and :sources.");
452
452
 
453
453
  column = grn_column_create(context, table, name, name_size,
454
- path, flags, value_type);
454
+ path, flags, value_type);
455
455
  if (context->rc) {
456
- rb_grn_context_check(context,
457
- rb_ary_new3(2, self, rb_ary_new4(argc, argv)));
456
+ rb_grn_context_check(context,
457
+ rb_ary_new3(2, self, rb_ary_new4(argc, argv)));
458
458
  }
459
459
 
460
460
  rb_column = GRNCOLUMN2RVAL(Qnil, context, column, GRN_TRUE);
461
461
  if (!NIL_P(rb_source))
462
- rb_funcall(rb_column, rb_intern("source="), 1, rb_source);
462
+ rb_funcall(rb_column, rb_intern("source="), 1, rb_source);
463
463
  if (!NIL_P(rb_sources))
464
- rb_funcall(rb_column, rb_intern("sources="), 1, rb_sources);
464
+ rb_funcall(rb_column, rb_intern("sources="), 1, rb_sources);
465
465
 
466
466
  rb_ary_push(columns, rb_column);
467
467
  rb_grn_named_object_set_name(RB_GRN_NAMED_OBJECT(DATA_PTR(rb_column)),
468
- name, name_size);
468
+ name, name_size);
469
469
 
470
470
  return rb_column;
471
471
  }
472
472
 
473
473
  static void
474
474
  ruby_object_to_column_name (VALUE rb_name,
475
- const char **name, unsigned *name_size)
475
+ const char **name, unsigned *name_size)
476
476
  {
477
477
  switch (TYPE(rb_name)) {
478
478
  case T_SYMBOL:
479
- *name = rb_id2name(SYM2ID(rb_name));
480
- *name_size = strlen(*name);
481
- break;
479
+ *name = rb_id2name(SYM2ID(rb_name));
480
+ *name_size = strlen(*name);
481
+ break;
482
482
  case T_STRING:
483
- *name = StringValuePtr(rb_name);
484
- *name_size = RSTRING_LEN(rb_name);
485
- break;
483
+ *name = StringValuePtr(rb_name);
484
+ *name_size = RSTRING_LEN(rb_name);
485
+ break;
486
486
  default:
487
- rb_raise(rb_eArgError,
488
- "column name should be String or Symbol: %s",
489
- rb_grn_inspect(rb_name));
490
- break;
487
+ rb_raise(rb_eArgError,
488
+ "column name should be String or Symbol: %s",
489
+ rb_grn_inspect(rb_name));
490
+ break;
491
491
  }
492
492
  }
493
493
 
@@ -514,46 +514,46 @@ rb_grn_table_get_column (VALUE self, VALUE rb_name)
514
514
  long i, n;
515
515
 
516
516
  rb_grn_table_deconstruct(SELF(self), &table, &context,
517
- NULL, NULL,
518
- NULL, NULL, NULL,
519
- &columns);
517
+ NULL, NULL,
518
+ NULL, NULL, NULL,
519
+ &columns);
520
520
 
521
521
  ruby_object_to_column_name(rb_name, &name, &name_size);
522
522
  raw_columns = RARRAY_PTR(columns);
523
523
  n = RARRAY_LEN(columns);
524
524
  for (i = 0; i < n; i++) {
525
- VALUE rb_column = raw_columns[i];
526
- RbGrnNamedObject *rb_grn_named_object;
527
-
528
- rb_grn_named_object = RB_GRN_NAMED_OBJECT(DATA_PTR(rb_column));
529
- if (name_size == rb_grn_named_object->name_size &&
530
- memcmp(name, rb_grn_named_object->name, name_size) == 0) {
531
- return rb_column;
532
- }
525
+ VALUE rb_column = raw_columns[i];
526
+ RbGrnNamedObject *rb_grn_named_object;
527
+
528
+ rb_grn_named_object = RB_GRN_NAMED_OBJECT(DATA_PTR(rb_column));
529
+ if (name_size == rb_grn_named_object->name_size &&
530
+ memcmp(name, rb_grn_named_object->name, name_size) == 0) {
531
+ return rb_column;
532
+ }
533
533
  }
534
534
 
535
535
  column = grn_obj_column(context, table, name, name_size);
536
536
  rb_grn_context_check(context, self);
537
537
  if (!column)
538
- return Qnil;
538
+ return Qnil;
539
539
 
540
540
  user_data = grn_obj_user_data(context, column);
541
541
  if (user_data) {
542
- RbGrnObject *rb_grn_object;
543
- rb_grn_object = user_data->ptr;
544
- if (rb_grn_object) {
545
- rb_ary_push(columns, rb_grn_object->self);
546
- return rb_grn_object->self;
547
- }
542
+ RbGrnObject *rb_grn_object;
543
+ rb_grn_object = user_data->ptr;
544
+ if (rb_grn_object) {
545
+ rb_ary_push(columns, rb_grn_object->self);
546
+ return rb_grn_object->self;
547
+ }
548
548
  }
549
549
 
550
550
  owner = column->header.type == GRN_ACCESSOR;
551
551
  rb_column = GRNCOLUMN2RVAL(Qnil, context, column, owner);
552
552
  if (owner) {
553
- rb_iv_set(rb_column, "table", self);
553
+ rb_iv_set(rb_column, "table", self);
554
554
  }
555
555
  rb_grn_named_object_set_name(RB_GRN_NAMED_OBJECT(DATA_PTR(rb_column)),
556
- name, name_size);
556
+ name, name_size);
557
557
 
558
558
  return rb_column;
559
559
  }
@@ -565,9 +565,9 @@ rb_grn_table_get_column_surely (VALUE self, VALUE rb_name)
565
565
 
566
566
  rb_column = rb_grn_table_get_column(self, rb_name);
567
567
  if (NIL_P(rb_column)) {
568
- rb_raise(rb_eGrnNoSuchColumn,
569
- "no such column: <%s>: <%s>",
570
- rb_grn_inspect(rb_name), rb_grn_inspect(self));
568
+ rb_raise(rb_eGrnNoSuchColumn,
569
+ "no such column: <%s>: <%s>",
570
+ rb_grn_inspect(rb_name), rb_grn_inspect(self));
571
571
  }
572
572
  return rb_column;
573
573
  }
@@ -594,55 +594,55 @@ rb_grn_table_get_columns (int argc, VALUE *argv, VALUE self)
594
594
  VALUE exception;
595
595
 
596
596
  rb_grn_table_deconstruct(SELF(self), &table, &context,
597
- NULL, NULL,
598
- NULL, NULL, NULL,
599
- NULL);
597
+ NULL, NULL,
598
+ NULL, NULL, NULL,
599
+ NULL);
600
600
 
601
601
  rb_scan_args(argc, argv, "01", &rb_name);
602
602
 
603
603
  if (!NIL_P(rb_name)) {
604
- name = StringValuePtr(rb_name);
605
- name_size = RSTRING_LEN(rb_name);
604
+ name = StringValuePtr(rb_name);
605
+ name_size = RSTRING_LEN(rb_name);
606
606
  }
607
607
 
608
608
  columns = grn_table_create(context, NULL, 0, NULL, GRN_TABLE_HASH_KEY,
609
- NULL, 0);
609
+ NULL, 0);
610
610
  n = grn_table_columns(context, table, name, name_size, columns);
611
611
  rb_grn_context_check(context, self);
612
612
 
613
613
  rb_columns = rb_ary_new2(n);
614
614
  if (n == 0) {
615
- grn_obj_unlink(context, columns);
616
- return rb_columns;
615
+ grn_obj_unlink(context, columns);
616
+ return rb_columns;
617
617
  }
618
618
 
619
619
  cursor = grn_table_cursor_open(context, columns, NULL, 0, NULL, 0,
620
- 0, -1, GRN_CURSOR_ASCENDING);
620
+ 0, -1, GRN_CURSOR_ASCENDING);
621
621
  rb_grn_context_check(context, self);
622
622
  while (grn_table_cursor_next(context, cursor) != GRN_ID_NIL) {
623
- void *key;
624
- grn_id *column_id;
625
- grn_obj *column;
626
- VALUE rb_column;
627
-
628
- grn_table_cursor_get_key(context, cursor, &key);
629
- column_id = key;
630
- column = grn_ctx_at(context, *column_id);
631
- exception = rb_grn_context_to_exception(context, self);
632
- if (!NIL_P(exception)) {
633
- grn_table_cursor_close(context, cursor);
634
- grn_obj_unlink(context, columns);
635
- rb_exc_raise(exception);
636
- }
637
-
638
- rb_column = GRNOBJECT2RVAL(Qnil, context, column, GRN_FALSE);
639
- rb_ary_push(rb_columns, rb_column);
623
+ void *key;
624
+ grn_id *column_id;
625
+ grn_obj *column;
626
+ VALUE rb_column;
627
+
628
+ grn_table_cursor_get_key(context, cursor, &key);
629
+ column_id = key;
630
+ column = grn_ctx_at(context, *column_id);
631
+ exception = rb_grn_context_to_exception(context, self);
632
+ if (!NIL_P(exception)) {
633
+ grn_table_cursor_close(context, cursor);
634
+ grn_obj_unlink(context, columns);
635
+ rb_exc_raise(exception);
636
+ }
637
+
638
+ rb_column = GRNOBJECT2RVAL(Qnil, context, column, GRN_FALSE);
639
+ rb_ary_push(rb_columns, rb_column);
640
640
  }
641
641
  rc = grn_table_cursor_close(context, cursor);
642
642
  grn_obj_unlink(context, columns);
643
643
  if (rc != GRN_SUCCESS) {
644
- rb_grn_context_check(context, self);
645
- rb_grn_rc_check(rc, self);
644
+ rb_grn_context_check(context, self);
645
+ rb_grn_rc_check(rc, self);
646
646
  }
647
647
 
648
648
  return rb_columns;
@@ -663,23 +663,23 @@ rb_grn_table_have_column (VALUE self, VALUE rb_name)
663
663
  unsigned name_size = 0;
664
664
 
665
665
  rb_grn_table_deconstruct(SELF(self), &table, &context,
666
- NULL, NULL,
667
- NULL, NULL, NULL,
668
- NULL);
666
+ NULL, NULL,
667
+ NULL, NULL, NULL,
668
+ NULL);
669
669
 
670
670
  ruby_object_to_column_name(rb_name, &name, &name_size);
671
671
  column = grn_obj_column(context, table, name, name_size);
672
672
  if (column) {
673
- grn_obj_unlink(context, column);
674
- return Qtrue;
673
+ grn_obj_unlink(context, column);
674
+ return Qtrue;
675
675
  } else {
676
- return Qfalse;
676
+ return Qfalse;
677
677
  }
678
678
  }
679
679
 
680
680
  static grn_table_cursor *
681
681
  rb_grn_table_open_grn_cursor (int argc, VALUE *argv, VALUE self,
682
- grn_ctx **context)
682
+ grn_ctx **context)
683
683
  {
684
684
  grn_obj *table;
685
685
  grn_table_cursor *cursor;
@@ -691,50 +691,50 @@ rb_grn_table_open_grn_cursor (int argc, VALUE *argv, VALUE self,
691
691
  VALUE rb_greater_than, rb_less_than, rb_offset, rb_limit;
692
692
 
693
693
  rb_grn_table_deconstruct(SELF(self), &table, context,
694
- NULL, NULL,
695
- NULL, NULL, NULL,
696
- NULL);
694
+ NULL, NULL,
695
+ NULL, NULL, NULL,
696
+ NULL);
697
697
 
698
698
  rb_scan_args(argc, argv, "01", &options);
699
699
 
700
700
  rb_grn_scan_options(options,
701
- "min", &rb_min,
701
+ "min", &rb_min,
702
702
  "max", &rb_max,
703
703
  "offset", &rb_offset,
704
704
  "limit", &rb_limit,
705
- "order", &rb_order,
706
- "order_by", &rb_order_by,
707
- "greater_than", &rb_greater_than,
708
- "less_than", &rb_less_than,
709
- NULL);
705
+ "order", &rb_order,
706
+ "order_by", &rb_order_by,
707
+ "greater_than", &rb_greater_than,
708
+ "less_than", &rb_less_than,
709
+ NULL);
710
710
 
711
711
  if (!NIL_P(rb_min)) {
712
- min_key = StringValuePtr(rb_min);
713
- min_key_size = RSTRING_LEN(rb_min);
712
+ min_key = StringValuePtr(rb_min);
713
+ min_key_size = RSTRING_LEN(rb_min);
714
714
  }
715
715
  if (!NIL_P(rb_max)) {
716
- max_key = StringValuePtr(rb_max);
717
- max_key_size = RSTRING_LEN(rb_max);
716
+ max_key = StringValuePtr(rb_max);
717
+ max_key_size = RSTRING_LEN(rb_max);
718
718
  }
719
719
  if (!NIL_P(rb_offset))
720
- offset = NUM2INT(rb_offset);
720
+ offset = NUM2INT(rb_offset);
721
721
  if (!NIL_P(rb_limit))
722
- limit = NUM2INT(rb_limit);
722
+ limit = NUM2INT(rb_limit);
723
723
 
724
724
  flags |= rb_grn_table_cursor_order_to_flag(rb_order);
725
725
  flags |= rb_grn_table_cursor_order_by_to_flag(table->header.type,
726
- self,
727
- rb_order_by);
726
+ self,
727
+ rb_order_by);
728
728
 
729
729
  if (RVAL2CBOOL(rb_greater_than))
730
- flags |= GRN_CURSOR_GT;
730
+ flags |= GRN_CURSOR_GT;
731
731
  if (RVAL2CBOOL(rb_less_than))
732
- flags |= GRN_CURSOR_LT;
732
+ flags |= GRN_CURSOR_LT;
733
733
 
734
734
  cursor = grn_table_cursor_open(*context, table,
735
- min_key, min_key_size,
736
- max_key, max_key_size,
737
- offset, limit, flags);
735
+ min_key, min_key_size,
736
+ max_key, max_key_size,
737
+ offset, limit, flags);
738
738
  rb_grn_context_check(*context, self);
739
739
 
740
740
  return cursor;
@@ -821,9 +821,9 @@ rb_grn_table_open_cursor (int argc, VALUE *argv, VALUE self)
821
821
  rb_cursor = GRNTABLECURSOR2RVAL(Qnil, context, cursor);
822
822
  rb_iv_set(rb_cursor, "@table", self); /* FIXME: cursor should mark table */
823
823
  if (rb_block_given_p())
824
- return rb_ensure(rb_yield, rb_cursor, rb_grn_object_close, rb_cursor);
824
+ return rb_ensure(rb_yield, rb_cursor, rb_grn_object_close, rb_cursor);
825
825
  else
826
- return rb_cursor;
826
+ return rb_cursor;
827
827
  }
828
828
 
829
829
  /*
@@ -844,7 +844,7 @@ rb_grn_table_get_records (int argc, VALUE *argv, VALUE self)
844
844
  cursor = rb_grn_table_open_grn_cursor(argc, argv, self, &context);
845
845
  records = rb_ary_new();
846
846
  while ((record_id = grn_table_cursor_next(context, cursor))) {
847
- rb_ary_push(records, rb_grn_record_new(self, record_id, Qnil));
847
+ rb_ary_push(records, rb_grn_record_new(self, record_id, Qnil));
848
848
  }
849
849
  grn_table_cursor_close(context, cursor);
850
850
 
@@ -865,9 +865,9 @@ rb_grn_table_get_size (VALUE self)
865
865
  unsigned int size;
866
866
 
867
867
  rb_grn_table_deconstruct(SELF(self), &table, &context,
868
- NULL, NULL,
869
- NULL, NULL, NULL,
870
- NULL);
868
+ NULL, NULL,
869
+ NULL, NULL, NULL,
870
+ NULL);
871
871
  size = grn_table_size(context, table);
872
872
  return UINT2NUM(size);
873
873
  }
@@ -885,9 +885,9 @@ rb_grn_table_empty_p (VALUE self)
885
885
  unsigned int size;
886
886
 
887
887
  rb_grn_table_deconstruct(SELF(self), &table, &context,
888
- NULL, NULL,
889
- NULL, NULL, NULL,
890
- NULL);
888
+ NULL, NULL,
889
+ NULL, NULL, NULL,
890
+ NULL);
891
891
  size = grn_table_size(context, table);
892
892
  return CBOOL2RVAL(size == 0);
893
893
  }
@@ -905,9 +905,9 @@ rb_grn_table_truncate (VALUE self)
905
905
  grn_rc rc;
906
906
 
907
907
  rb_grn_table_deconstruct(SELF(self), &table, &context,
908
- NULL, NULL,
909
- NULL, NULL, NULL,
910
- NULL);
908
+ NULL, NULL,
909
+ NULL, NULL, NULL,
910
+ NULL);
911
911
  rc = grn_table_truncate(context, table);
912
912
  rb_grn_rc_check(rc, self);
913
913
 
@@ -944,8 +944,8 @@ rb_grn_table_each (int argc, VALUE *argv, VALUE self)
944
944
  rb_table = SELF(self);
945
945
  rb_grn_object = RB_GRN_OBJECT(rb_table);
946
946
  while (rb_grn_object->object &&
947
- (id = grn_table_cursor_next(context, cursor)) != GRN_ID_NIL) {
948
- rb_yield(rb_grn_record_new(self, id, Qnil));
947
+ (id = grn_table_cursor_next(context, cursor)) != GRN_ID_NIL) {
948
+ rb_yield(rb_grn_record_new(self, id, Qnil));
949
949
  }
950
950
  rb_grn_object_close(rb_cursor);
951
951
 
@@ -961,9 +961,9 @@ rb_grn_table_delete_by_id (VALUE self, VALUE rb_id)
961
961
  grn_rc rc;
962
962
 
963
963
  rb_grn_table_deconstruct(SELF(self), &table, &context,
964
- NULL, NULL,
965
- NULL, NULL, NULL,
966
- NULL);
964
+ NULL, NULL,
965
+ NULL, NULL, NULL,
966
+ NULL);
967
967
 
968
968
  id = NUM2UINT(rb_id);
969
969
  rc = grn_table_delete_by_id(context, table, id);
@@ -983,38 +983,38 @@ rb_grn_table_delete_by_expression (VALUE self)
983
983
  grn_table_cursor *cursor;
984
984
 
985
985
  rb_grn_table_deconstruct(SELF(self), &table, &context,
986
- NULL, NULL,
987
- NULL, NULL, NULL,
988
- NULL);
986
+ NULL, NULL,
987
+ NULL, NULL, NULL,
988
+ NULL);
989
989
 
990
990
  rb_builder = rb_grn_record_expression_builder_new(self, Qnil);
991
991
  rb_expression = rb_grn_record_expression_builder_build(rb_builder);
992
992
  rb_grn_object_deconstruct(RB_GRN_OBJECT(DATA_PTR(rb_expression)),
993
993
  &expression, NULL,
994
- NULL, NULL, NULL, NULL);
994
+ NULL, NULL, NULL, NULL);
995
995
 
996
996
  needless_records =
997
- grn_table_create(context, NULL, 0, NULL,
998
- GRN_TABLE_HASH_KEY | GRN_OBJ_WITH_SUBREC,
999
- table,
1000
- NULL);
997
+ grn_table_create(context, NULL, 0, NULL,
998
+ GRN_TABLE_HASH_KEY | GRN_OBJ_WITH_SUBREC,
999
+ table,
1000
+ NULL);
1001
1001
  if (!needless_records) {
1002
- rb_grn_context_check(context, self);
1003
- rb_grn_rc_check(GRN_NO_MEMORY_AVAILABLE, self);
1002
+ rb_grn_context_check(context, self);
1003
+ rb_grn_rc_check(GRN_NO_MEMORY_AVAILABLE, self);
1004
1004
  }
1005
1005
 
1006
1006
  grn_table_select(context, table, expression, needless_records, operator);
1007
1007
  cursor = grn_table_cursor_open(context, needless_records,
1008
- NULL, 0,
1009
- NULL, 0,
1010
- 0, -1, 0);
1008
+ NULL, 0,
1009
+ NULL, 0,
1010
+ 0, -1, 0);
1011
1011
  if (cursor) {
1012
- while (grn_table_cursor_next(context, cursor)) {
1013
- grn_id *id;
1014
- grn_table_cursor_get_key(context, cursor, (void **)&id);
1015
- grn_table_delete_by_id(context, table, *id);
1016
- }
1017
- grn_table_cursor_close(context, cursor);
1012
+ while (grn_table_cursor_next(context, cursor)) {
1013
+ grn_id *id;
1014
+ grn_table_cursor_get_key(context, cursor, (void **)&id);
1015
+ grn_table_delete_by_id(context, table, *id);
1016
+ }
1017
+ grn_table_cursor_close(context, cursor);
1018
1018
  }
1019
1019
  grn_obj_unlink(context, needless_records);
1020
1020
 
@@ -1055,9 +1055,9 @@ rb_grn_table_delete (int argc, VALUE *argv, VALUE self)
1055
1055
  rb_scan_args(argc, argv, "01", &rb_id);
1056
1056
 
1057
1057
  if (rb_block_given_p()) {
1058
- rb_grn_table_delete_by_expression(self);
1058
+ rb_grn_table_delete_by_expression(self);
1059
1059
  } else {
1060
- rb_grn_table_delete_by_id(self, rb_id);
1060
+ rb_grn_table_delete_by_id(self, rb_id);
1061
1061
  }
1062
1062
 
1063
1063
  return Qnil;
@@ -1140,11 +1140,11 @@ rb_grn_table_delete (int argc, VALUE *argv, VALUE self)
1140
1140
  * {::Array} since 2.1.0. If you want to get before 2.1.0 style
1141
1141
  * result, use the following code:
1142
1142
  *
1143
- * @example Describe incompatible API change
1144
- * result_since_2_1_0 = table.sort(["sort_key"])
1145
- * result_before_2_1_0 = result_since_2_1_0.collect do |record|
1146
- * record.value
1147
- * end
1143
+ * @example Describe incompatible API change
1144
+ * result_since_2_1_0 = table.sort(["sort_key"])
1145
+ * result_before_2_1_0 = result_since_2_1_0.collect do |record|
1146
+ * record.value
1147
+ * end
1148
1148
  */
1149
1149
  static VALUE
1150
1150
  rb_grn_table_sort (int argc, VALUE *argv, VALUE self)
@@ -1161,80 +1161,80 @@ rb_grn_table_sort (int argc, VALUE *argv, VALUE self)
1161
1161
  VALUE exception;
1162
1162
 
1163
1163
  rb_grn_table_deconstruct(SELF(self), &table, &context,
1164
- NULL, NULL,
1165
- NULL, NULL, NULL,
1166
- NULL);
1164
+ NULL, NULL,
1165
+ NULL, NULL, NULL,
1166
+ NULL);
1167
1167
 
1168
1168
  rb_scan_args(argc, argv, "11", &rb_keys, &options);
1169
1169
 
1170
1170
  if (!RVAL2CBOOL(rb_obj_is_kind_of(rb_keys, rb_cArray)))
1171
- rb_raise(rb_eArgError, "keys should be an array of key: <%s>",
1172
- rb_grn_inspect(rb_keys));
1171
+ rb_raise(rb_eArgError, "keys should be an array of key: <%s>",
1172
+ rb_grn_inspect(rb_keys));
1173
1173
 
1174
1174
  n_keys = RARRAY_LEN(rb_keys);
1175
1175
  rb_sort_keys = RARRAY_PTR(rb_keys);
1176
1176
  keys = ALLOCA_N(grn_table_sort_key, n_keys);
1177
1177
  for (i = 0; i < n_keys; i++) {
1178
- VALUE rb_sort_options, rb_key, rb_resolved_key, rb_order;
1179
-
1180
- if (RVAL2CBOOL(rb_obj_is_kind_of(rb_sort_keys[i], rb_cHash))) {
1181
- rb_sort_options = rb_sort_keys[i];
1182
- } else if (RVAL2CBOOL(rb_obj_is_kind_of(rb_sort_keys[i], rb_cArray))) {
1183
- rb_sort_options = rb_hash_new();
1184
- rb_hash_aset(rb_sort_options,
1185
- RB_GRN_INTERN("key"),
1186
- rb_ary_entry(rb_sort_keys[i], 0));
1187
- rb_hash_aset(rb_sort_options,
1188
- RB_GRN_INTERN("order"),
1189
- rb_ary_entry(rb_sort_keys[i], 1));
1190
- } else {
1191
- rb_sort_options = rb_hash_new();
1192
- rb_hash_aset(rb_sort_options,
1193
- RB_GRN_INTERN("key"),
1194
- rb_sort_keys[i]);
1195
- }
1196
- rb_grn_scan_options(rb_sort_options,
1197
- "key", &rb_key,
1198
- "order", &rb_order,
1199
- NULL);
1200
- if (RVAL2CBOOL(rb_obj_is_kind_of(rb_key, rb_cString))) {
1201
- rb_resolved_key = rb_grn_table_get_column(self, rb_key);
1202
- } else {
1203
- rb_resolved_key = rb_key;
1204
- }
1205
- keys[i].key = RVAL2GRNOBJECT(rb_resolved_key, &context);
1206
- if (!keys[i].key) {
1207
- rb_raise(rb_eGrnNoSuchColumn,
1208
- "no such column: <%s>: <%s>",
1209
- rb_grn_inspect(rb_key), rb_grn_inspect(self));
1210
- }
1211
- if (NIL_P(rb_order) ||
1212
- rb_grn_equal_option(rb_order, "asc") ||
1213
- rb_grn_equal_option(rb_order, "ascending")) {
1214
- keys[i].flags = GRN_TABLE_SORT_ASC;
1215
- } else if (rb_grn_equal_option(rb_order, "desc") ||
1216
- rb_grn_equal_option(rb_order, "descending")) {
1217
- keys[i].flags = GRN_TABLE_SORT_DESC;
1218
- } else {
1219
- rb_raise(rb_eArgError,
1220
- "order should be one of "
1221
- "[nil, :desc, :descending, :asc, :ascending]: %s",
1222
- rb_grn_inspect(rb_order));
1223
- }
1178
+ VALUE rb_sort_options, rb_key, rb_resolved_key, rb_order;
1179
+
1180
+ if (RVAL2CBOOL(rb_obj_is_kind_of(rb_sort_keys[i], rb_cHash))) {
1181
+ rb_sort_options = rb_sort_keys[i];
1182
+ } else if (RVAL2CBOOL(rb_obj_is_kind_of(rb_sort_keys[i], rb_cArray))) {
1183
+ rb_sort_options = rb_hash_new();
1184
+ rb_hash_aset(rb_sort_options,
1185
+ RB_GRN_INTERN("key"),
1186
+ rb_ary_entry(rb_sort_keys[i], 0));
1187
+ rb_hash_aset(rb_sort_options,
1188
+ RB_GRN_INTERN("order"),
1189
+ rb_ary_entry(rb_sort_keys[i], 1));
1190
+ } else {
1191
+ rb_sort_options = rb_hash_new();
1192
+ rb_hash_aset(rb_sort_options,
1193
+ RB_GRN_INTERN("key"),
1194
+ rb_sort_keys[i]);
1195
+ }
1196
+ rb_grn_scan_options(rb_sort_options,
1197
+ "key", &rb_key,
1198
+ "order", &rb_order,
1199
+ NULL);
1200
+ if (RVAL2CBOOL(rb_obj_is_kind_of(rb_key, rb_cString))) {
1201
+ rb_resolved_key = rb_grn_table_get_column(self, rb_key);
1202
+ } else {
1203
+ rb_resolved_key = rb_key;
1204
+ }
1205
+ keys[i].key = RVAL2GRNOBJECT(rb_resolved_key, &context);
1206
+ if (!keys[i].key) {
1207
+ rb_raise(rb_eGrnNoSuchColumn,
1208
+ "no such column: <%s>: <%s>",
1209
+ rb_grn_inspect(rb_key), rb_grn_inspect(self));
1210
+ }
1211
+ if (NIL_P(rb_order) ||
1212
+ rb_grn_equal_option(rb_order, "asc") ||
1213
+ rb_grn_equal_option(rb_order, "ascending")) {
1214
+ keys[i].flags = GRN_TABLE_SORT_ASC;
1215
+ } else if (rb_grn_equal_option(rb_order, "desc") ||
1216
+ rb_grn_equal_option(rb_order, "descending")) {
1217
+ keys[i].flags = GRN_TABLE_SORT_DESC;
1218
+ } else {
1219
+ rb_raise(rb_eArgError,
1220
+ "order should be one of "
1221
+ "[nil, :desc, :descending, :asc, :ascending]: %s",
1222
+ rb_grn_inspect(rb_order));
1223
+ }
1224
1224
  }
1225
1225
 
1226
1226
  rb_grn_scan_options(options,
1227
- "offset", &rb_offset,
1228
- "limit", &rb_limit,
1229
- NULL);
1227
+ "offset", &rb_offset,
1228
+ "limit", &rb_limit,
1229
+ NULL);
1230
1230
 
1231
1231
  if (!NIL_P(rb_offset))
1232
- offset = NUM2INT(rb_offset);
1232
+ offset = NUM2INT(rb_offset);
1233
1233
  if (!NIL_P(rb_limit))
1234
- limit = NUM2INT(rb_limit);
1234
+ limit = NUM2INT(rb_limit);
1235
1235
 
1236
1236
  result = grn_table_create(context, NULL, 0, NULL, GRN_TABLE_NO_KEY,
1237
- NULL, table);
1237
+ NULL, table);
1238
1238
  /* use n_records that is return value from
1239
1239
  grn_table_sort() when rroonga user become specifying
1240
1240
  output table. */
@@ -1272,71 +1272,71 @@ rb_grn_table_group (int argc, VALUE *argv, VALUE self)
1272
1272
  VALUE rb_results;
1273
1273
 
1274
1274
  rb_grn_table_deconstruct(SELF(self), &table, &context,
1275
- NULL, NULL,
1276
- NULL, NULL, NULL,
1277
- NULL);
1275
+ NULL, NULL,
1276
+ NULL, NULL, NULL,
1277
+ NULL);
1278
1278
 
1279
1279
  rb_scan_args(argc, argv, "11", &rb_keys, &rb_options);
1280
1280
 
1281
1281
  if (TYPE(rb_keys) == T_ARRAY) {
1282
- n_keys = RARRAY_LEN(rb_keys);
1283
- rb_group_keys = RARRAY_PTR(rb_keys);
1282
+ n_keys = RARRAY_LEN(rb_keys);
1283
+ rb_group_keys = RARRAY_PTR(rb_keys);
1284
1284
  } else {
1285
- n_keys = 1;
1286
- rb_group_keys = &rb_keys;
1285
+ n_keys = 1;
1286
+ rb_group_keys = &rb_keys;
1287
1287
  }
1288
1288
 
1289
1289
  keys = ALLOCA_N(grn_table_sort_key, n_keys);
1290
1290
  for (i = 0; i < n_keys; i++) {
1291
- VALUE rb_sort_options, rb_key;
1292
-
1293
- if (RVAL2CBOOL(rb_obj_is_kind_of(rb_group_keys[i], rb_cHash))) {
1294
- rb_sort_options = rb_group_keys[i];
1295
- } else {
1296
- rb_sort_options = rb_hash_new();
1297
- rb_hash_aset(rb_sort_options,
1298
- RB_GRN_INTERN("key"),
1299
- rb_group_keys[i]);
1300
- }
1301
- rb_grn_scan_options(rb_sort_options,
1302
- "key", &rb_key,
1303
- NULL);
1304
- if (RVAL2CBOOL(rb_obj_is_kind_of(rb_key, rb_cString))) {
1305
- VALUE resolved_rb_key;
1306
- resolved_rb_key = rb_grn_table_get_column(self, rb_key);
1307
- if (NIL_P(resolved_rb_key)) {
1308
- rb_raise(rb_eArgError,
1309
- "unknown group key: <%s>: <%s>",
1310
- rb_grn_inspect(rb_key),
1311
- rb_grn_inspect(self));
1312
- }
1313
- rb_key = resolved_rb_key;
1314
- }
1315
- keys[i].key = RVAL2GRNOBJECT(rb_key, &context);
1316
- keys[i].flags = 0;
1291
+ VALUE rb_sort_options, rb_key;
1292
+
1293
+ if (RVAL2CBOOL(rb_obj_is_kind_of(rb_group_keys[i], rb_cHash))) {
1294
+ rb_sort_options = rb_group_keys[i];
1295
+ } else {
1296
+ rb_sort_options = rb_hash_new();
1297
+ rb_hash_aset(rb_sort_options,
1298
+ RB_GRN_INTERN("key"),
1299
+ rb_group_keys[i]);
1300
+ }
1301
+ rb_grn_scan_options(rb_sort_options,
1302
+ "key", &rb_key,
1303
+ NULL);
1304
+ if (RVAL2CBOOL(rb_obj_is_kind_of(rb_key, rb_cString))) {
1305
+ VALUE resolved_rb_key;
1306
+ resolved_rb_key = rb_grn_table_get_column(self, rb_key);
1307
+ if (NIL_P(resolved_rb_key)) {
1308
+ rb_raise(rb_eArgError,
1309
+ "unknown group key: <%s>: <%s>",
1310
+ rb_grn_inspect(rb_key),
1311
+ rb_grn_inspect(self));
1312
+ }
1313
+ rb_key = resolved_rb_key;
1314
+ }
1315
+ keys[i].key = RVAL2GRNOBJECT(rb_key, &context);
1316
+ keys[i].flags = 0;
1317
1317
  }
1318
1318
 
1319
1319
  n_results = n_keys;
1320
1320
  results = ALLOCA_N(grn_table_group_result, n_results);
1321
1321
  rb_results = rb_ary_new();
1322
1322
  for (i = 0; i < n_results; i++) {
1323
- grn_obj *result;
1324
- grn_id range_id;
1325
- VALUE rb_result;
1326
-
1327
- range_id = grn_obj_get_range(context, keys[i].key);
1328
- result = grn_table_create(context, NULL, 0, NULL,
1329
- GRN_TABLE_HASH_KEY | GRN_OBJ_WITH_SUBREC,
1330
- grn_ctx_at(context, range_id), 0);
1331
- results[i].table = result;
1332
- results[i].key_begin = 0;
1333
- results[i].key_end = 0;
1334
- results[i].limit = 0;
1335
- results[i].flags = 0;
1336
- results[i].op = GRN_OP_OR;
1337
-
1338
- rb_result = GRNOBJECT2RVAL(Qnil, context, result, GRN_TRUE);
1339
- rb_ary_push(rb_results, rb_result);
1323
+ grn_obj *result;
1324
+ grn_id range_id;
1325
+ VALUE rb_result;
1326
+
1327
+ range_id = grn_obj_get_range(context, keys[i].key);
1328
+ result = grn_table_create(context, NULL, 0, NULL,
1329
+ GRN_TABLE_HASH_KEY | GRN_OBJ_WITH_SUBREC,
1330
+ grn_ctx_at(context, range_id), 0);
1331
+ results[i].table = result;
1332
+ results[i].key_begin = 0;
1333
+ results[i].key_end = 0;
1334
+ results[i].limit = 0;
1335
+ results[i].flags = 0;
1336
+ results[i].op = GRN_OP_OR;
1337
+
1338
+ rb_result = GRNOBJECT2RVAL(Qnil, context, result, GRN_TRUE);
1339
+ rb_ary_push(rb_results, rb_result);
1340
1340
  }
1341
1341
 
1342
1342
  rc = grn_table_group(context, table, keys, n_keys, results, n_results);
@@ -1344,9 +1344,9 @@ rb_grn_table_group (int argc, VALUE *argv, VALUE self)
1344
1344
  rb_grn_rc_check(rc, self);
1345
1345
 
1346
1346
  if (n_results == 1)
1347
- return rb_ary_pop(rb_results);
1347
+ return rb_ary_pop(rb_results);
1348
1348
  else
1349
- return rb_results;
1349
+ return rb_results;
1350
1350
  }
1351
1351
 
1352
1352
  /*
@@ -1361,9 +1361,9 @@ VALUE
1361
1361
  rb_grn_table_array_reference (VALUE self, VALUE rb_id)
1362
1362
  {
1363
1363
  if (FIXNUM_P(rb_id)) {
1364
- return rb_grn_record_new_raw(self, rb_id, Qnil);
1364
+ return rb_grn_record_new_raw(self, rb_id, Qnil);
1365
1365
  } else {
1366
- return Qnil;
1366
+ return Qnil;
1367
1367
  }
1368
1368
  }
1369
1369
 
@@ -1377,9 +1377,9 @@ rb_grn_table_get_value (VALUE self, VALUE rb_id)
1377
1377
  grn_obj *value;
1378
1378
 
1379
1379
  rb_grn_table_deconstruct(SELF(self), &table, &context,
1380
- NULL, NULL,
1381
- &value, NULL, &range,
1382
- NULL);
1380
+ NULL, NULL,
1381
+ &value, NULL, &range,
1382
+ NULL);
1383
1383
 
1384
1384
  id = NUM2UINT(rb_id);
1385
1385
  GRN_BULK_REWIND(value);
@@ -1408,16 +1408,16 @@ rb_grn_table_get_value_convenience (int argc, VALUE *argv, VALUE self)
1408
1408
 
1409
1409
  rb_scan_args(argc, argv, "11", &rb_id, &rb_options);
1410
1410
  if (!NIL_P(rb_options)) {
1411
- VALUE rb_option_id;
1412
- rb_grn_scan_options(rb_options,
1413
- "id", &rb_option_id,
1414
- NULL);
1415
- if (!(NIL_P(rb_option_id) || RVAL2CBOOL(rb_option_id))) {
1416
- rb_raise(rb_eArgError, ":id options must be true or nil: %s: %s",
1417
- rb_grn_inspect(rb_option_id),
1418
- rb_grn_inspect(rb_ary_new3(2,
1419
- self, rb_ary_new4(argc, argv))));
1420
- }
1411
+ VALUE rb_option_id;
1412
+ rb_grn_scan_options(rb_options,
1413
+ "id", &rb_option_id,
1414
+ NULL);
1415
+ if (!(NIL_P(rb_option_id) || RVAL2CBOOL(rb_option_id))) {
1416
+ rb_raise(rb_eArgError, ":id options must be true or nil: %s: %s",
1417
+ rb_grn_inspect(rb_option_id),
1418
+ rb_grn_inspect(rb_ary_new3(2,
1419
+ self, rb_ary_new4(argc, argv))));
1420
+ }
1421
1421
  }
1422
1422
 
1423
1423
  return rb_grn_table_get_value(self, rb_id);
@@ -1434,9 +1434,9 @@ rb_grn_table_set_value (VALUE self, VALUE rb_id, VALUE rb_value)
1434
1434
  grn_rc rc;
1435
1435
 
1436
1436
  rb_grn_table_deconstruct(SELF(self), &table, &context,
1437
- NULL, NULL,
1438
- &value, NULL, &range,
1439
- NULL);
1437
+ NULL, NULL,
1438
+ &value, NULL, &range,
1439
+ NULL);
1440
1440
 
1441
1441
  id = NUM2UINT(rb_id);
1442
1442
  GRN_BULK_REWIND(value);
@@ -1466,16 +1466,16 @@ rb_grn_table_set_value_convenience (int argc, VALUE *argv, VALUE self)
1466
1466
 
1467
1467
  rb_scan_args(argc, argv, "21", &rb_id, &rb_value, &rb_options);
1468
1468
  if (!NIL_P(rb_options)) {
1469
- VALUE rb_option_id;
1470
- rb_grn_scan_options(rb_options,
1471
- "id", &rb_option_id,
1472
- NULL);
1473
- if (!(NIL_P(rb_option_id) || RVAL2CBOOL(rb_option_id))) {
1474
- rb_raise(rb_eArgError, ":id options must be true or nil: %s: %s",
1475
- rb_grn_inspect(rb_option_id),
1476
- rb_grn_inspect(rb_ary_new3(2,
1477
- self, rb_ary_new4(argc, argv))));
1478
- }
1469
+ VALUE rb_option_id;
1470
+ rb_grn_scan_options(rb_options,
1471
+ "id", &rb_option_id,
1472
+ NULL);
1473
+ if (!(NIL_P(rb_option_id) || RVAL2CBOOL(rb_option_id))) {
1474
+ rb_raise(rb_eArgError, ":id options must be true or nil: %s: %s",
1475
+ rb_grn_inspect(rb_option_id),
1476
+ rb_grn_inspect(rb_ary_new3(2,
1477
+ self, rb_ary_new4(argc, argv))));
1478
+ }
1479
1479
  }
1480
1480
 
1481
1481
  return rb_grn_table_set_value(self, rb_id, rb_value);
@@ -1517,17 +1517,17 @@ rb_grn_table_get_column_value_convenience (int argc, VALUE *argv, VALUE self)
1517
1517
 
1518
1518
  rb_scan_args(argc, argv, "21", &rb_id, &rb_name, &rb_options);
1519
1519
  if (!NIL_P(rb_options)) {
1520
- VALUE rb_option_id;
1521
- rb_grn_scan_options(rb_options,
1522
- "id", &rb_option_id,
1523
- NULL);
1524
- if (!(NIL_P(rb_option_id) || RVAL2CBOOL(rb_option_id))) {
1525
- rb_raise(rb_eArgError, ":id options must be true or nil: %s: %s",
1526
- rb_grn_inspect(rb_option_id),
1527
- rb_grn_inspect(rb_ary_new3(2,
1528
- self,
1529
- rb_ary_new4(argc, argv))));
1530
- }
1520
+ VALUE rb_option_id;
1521
+ rb_grn_scan_options(rb_options,
1522
+ "id", &rb_option_id,
1523
+ NULL);
1524
+ if (!(NIL_P(rb_option_id) || RVAL2CBOOL(rb_option_id))) {
1525
+ rb_raise(rb_eArgError, ":id options must be true or nil: %s: %s",
1526
+ rb_grn_inspect(rb_option_id),
1527
+ rb_grn_inspect(rb_ary_new3(2,
1528
+ self,
1529
+ rb_ary_new4(argc, argv))));
1530
+ }
1531
1531
  }
1532
1532
 
1533
1533
  return rb_grn_table_get_column_value(self, rb_id, rb_name);
@@ -1535,7 +1535,7 @@ rb_grn_table_get_column_value_convenience (int argc, VALUE *argv, VALUE self)
1535
1535
 
1536
1536
  VALUE
1537
1537
  rb_grn_table_set_column_value_raw (VALUE self, grn_id id,
1538
- VALUE rb_name, VALUE rb_value)
1538
+ VALUE rb_name, VALUE rb_value)
1539
1539
  {
1540
1540
  VALUE rb_column;
1541
1541
 
@@ -1547,22 +1547,169 @@ rb_grn_table_set_column_value_raw (VALUE self, grn_id id,
1547
1547
 
1548
1548
  VALUE
1549
1549
  rb_grn_table_set_column_value (VALUE self, VALUE rb_id,
1550
- VALUE rb_name, VALUE rb_value)
1550
+ VALUE rb_name, VALUE rb_value)
1551
1551
  {
1552
1552
  return rb_grn_table_set_column_value_raw(self, NUM2INT(rb_id),
1553
- rb_name, rb_value);
1553
+ rb_name, rb_value);
1554
1554
  }
1555
1555
 
1556
1556
  /*
1557
- * _table_ _id_ に対応するカラム _name_ の値として _value_ 設定す
1558
- * る。既存の値は上書きされる。
1557
+ * Sets @value@ as the value of column @name@ of the record that has
1558
+ * @id@ ID. It overwrites the previous value.
1559
1559
  *
1560
- * @:id => true@ が指定できるのは利便性のため。
1561
- * {Groonga::Array} でも {Groonga::Hash} や {Groonga::PatriciaTrie} と
1562
- * 同じ引数で動くようになる。
1560
+ * @return [void]
1563
1561
  *
1564
1562
  * @overload set_column_value(id, name, value)
1565
- * @overload set_column_value(id, name, valuf, :id => true)
1563
+ * @!macro [new] table.set_column_value.base_arguments
1564
+ * @param id [Integer] The ID of the target record.
1565
+ * @param name [String or Symbol] The name of the target column.
1566
+ * @!macro [new] table.set_column_value.value
1567
+ * @param value [::Object] The new value.
1568
+ *
1569
+ * @!macro table.set_column_value.base_arguments
1570
+ * @!macro table.set_column_value.value
1571
+ *
1572
+ * @overload set_column_value(id, name, vector_value_with_weight)
1573
+ * Sets the vector column value and its weight. Weight is used when fulltext
1574
+ * search. In fulltext search, score @1@ is added when a record is matched
1575
+ * against a query. If weight is set, score @1 + weight@ is added when
1576
+ * a record is matched against a query.
1577
+ *
1578
+ * @note To use weight, there are two requirements. They are using vector
1579
+ * column and using index column with weight support. Weight supported
1580
+ * index column can be created with @:with_weight => true@ option.
1581
+ * See {#define_index_column}.
1582
+ *
1583
+ * @example Sets vector value with weight
1584
+ * Groonga::Schema.define do |schema|
1585
+ * schema.create_table("Sites") do |table|
1586
+ * table.short_text("name")
1587
+ * table.short_text("tags", :type => :vector) # It must be vector
1588
+ * end
1589
+ *
1590
+ * schema.create_table("Tags",
1591
+ * :type => :patricia_trie,
1592
+ * :key_type => :short_text) do |table|
1593
+ * table.index("Sites.tags",
1594
+ * :with_weight => true) # Don't forget :with_weight => true!
1595
+ * end
1596
+ * end
1597
+ *
1598
+ * sites = Groonga["Sites"]
1599
+ *
1600
+ * groonga_org_id = sites.add.id
1601
+ * sites.set_column_value(groonga_org_id,
1602
+ * "name",
1603
+ * "groonga.org")
1604
+ * sites.set_column_value(groonga_org_id,
1605
+ * "tags",
1606
+ * [
1607
+ * # 10 weight is set
1608
+ * {
1609
+ * :value => "groonga",
1610
+ * :weight => 10,
1611
+ * },
1612
+ * # No :weight. The default weight is used.
1613
+ * {
1614
+ * :value => "search engine",
1615
+ * },
1616
+ * # Value only. The default weight is used.
1617
+ * "fulltext search",
1618
+ * ])
1619
+ *
1620
+ * # "groonga" tag has 10 weight.
1621
+ * records = sites.select do |record|
1622
+ * record.tags =~ "groonga"
1623
+ * end
1624
+ * p records.collect(&:score) # => [11] (1 + 10 weight)
1625
+ *
1626
+ * # "search engine" tag has the default weight. (0 weight)
1627
+ * records = sites.select do |record|
1628
+ * record.tags =~ "search engine"
1629
+ * end
1630
+ * p records.collect(&:score) # => [1] (1 + 0 weight)
1631
+ *
1632
+ * # "fulltext search" tag has the default weight. (0 weight)
1633
+ * records = sites.select do |record|
1634
+ * record.tags =~ "fulltext search"
1635
+ * end
1636
+ * p records.collect(&:score) # => [1] (1 + 0 weight)
1637
+ *
1638
+ * @!macro [new] table.set_column_value.vector_value_with_weight
1639
+ * @param vector_value_with_weight
1640
+ * [::Array<::Hash{:value => ::Object, :weight => Integer}, ::Object>]
1641
+ * The new vector value with weight. The vector value can contain both
1642
+ * ::Hash and value. If a contained element uses ::Hash style, it can
1643
+ * specify its weight. If a contained element doesn't use ::Hash style,
1644
+ * it can't specify its weight.
1645
+ *
1646
+ * If ::Hash contains @:weight@ key, its value is used as weight for
1647
+ * @:value@ key's value. If ::Hash contains only @:value@ or @:weight@
1648
+ * value is nil, the default weight is used. The default weight is 0.
1649
+ *
1650
+ * @!macro table.set_column_value.base_arguments
1651
+ * @!macro table.set_column_value.vector_value_with_weight
1652
+ *
1653
+ * @overload set_column_value(id, name, value, options)
1654
+ * This usage is just for convenience. #set_column_value is overrided
1655
+ * by {Groonga::Table::KeySupport#set_column_value}.
1656
+ * {Groonga::Table::KeySupport#set_column_value} accepts not only ID
1657
+ * but also key value as the first argument. If you specify
1658
+ * @:id => true@ as @options, you can use both this
1659
+ * {#set_column_value} method and {Groonga::Table::KeySupport#set_column_value}
1660
+ * with the same way.
1661
+ *
1662
+ * @example Uses @:id => true@ for polymorphic usage
1663
+ * Groonga::Schema.define do |schema|
1664
+ * schema.create_table("Sites",
1665
+ * :type => :hash,
1666
+ * :key_type => :short_text) do |table|
1667
+ * table.short_text("name")
1668
+ * end
1669
+ *
1670
+ * schema.create_table("Logs") do |table|
1671
+ * table.short_text("content")
1672
+ * end
1673
+ * end
1674
+ *
1675
+ * sites = Groonga["Sites"]
1676
+ * logs = Groonga["Logs"]
1677
+ *
1678
+ * groonga_org_key = "http://groonga.org/"
1679
+ * groonga_org_id = sites.add(groonga_org_key).id
1680
+ * p sites.class # => Groonga::Hash
1681
+ * # :id => true is required!
1682
+ * sites.set_column_value(groonga_org_id,
1683
+ * "name",
1684
+ * "The official groonga site",
1685
+ * :id => true)
1686
+ * p sites[groonga_org_key].name # => "The official groonga site"
1687
+ *
1688
+ * log_id = logs.add.id
1689
+ * p logs.class # => Groonga::Array
1690
+ * # :id => true is optional. It is just ignored.
1691
+ * logs.set_column_value(log_id,
1692
+ * "content",
1693
+ * "127.0.0.1 - - [...]",
1694
+ * :id => true)
1695
+ * p logs[log_id].content # => "127.0.0.1 - - [...]"
1696
+ *
1697
+ * @!macro [new] table.set_column_value.options
1698
+ * @param options [::Hash] The options
1699
+ * @option options [Boolean] :id It is just for convenience.
1700
+ * Specify @true@ for polymorphic usage.
1701
+ *
1702
+ * @!macro table.set_column_value.base_arguments
1703
+ * @!macro table.set_column_value.value
1704
+ * @!macro table.set_column_value.options
1705
+ *
1706
+ * @overload set_column_value(id, name, vector_value_with_weight, options)
1707
+ * It is weight supported vector value variable of @:id => true@ option.
1708
+ * See other signature for usage.
1709
+ *
1710
+ * @!macro table.set_column_value.base_arguments
1711
+ * @!macro table.set_column_value.vector_value_with_weight
1712
+ * @!macro table.set_column_value.options
1566
1713
  */
1567
1714
  static VALUE
1568
1715
  rb_grn_table_set_column_value_convenience (int argc, VALUE *argv, VALUE self)
@@ -1571,17 +1718,17 @@ rb_grn_table_set_column_value_convenience (int argc, VALUE *argv, VALUE self)
1571
1718
 
1572
1719
  rb_scan_args(argc, argv, "31", &rb_id, &rb_name, &rb_value, &rb_options);
1573
1720
  if (!NIL_P(rb_options)) {
1574
- VALUE rb_option_id;
1575
- rb_grn_scan_options(rb_options,
1576
- "id", &rb_option_id,
1577
- NULL);
1578
- if (!(NIL_P(rb_option_id) || RVAL2CBOOL(rb_option_id))) {
1579
- rb_raise(rb_eArgError, ":id options must be true or nil: %s: %s",
1580
- rb_grn_inspect(rb_option_id),
1581
- rb_grn_inspect(rb_ary_new3(2,
1582
- self,
1583
- rb_ary_new4(argc, argv))));
1584
- }
1721
+ VALUE rb_option_id;
1722
+ rb_grn_scan_options(rb_options,
1723
+ "id", &rb_option_id,
1724
+ NULL);
1725
+ if (!(NIL_P(rb_option_id) || RVAL2CBOOL(rb_option_id))) {
1726
+ rb_raise(rb_eArgError, ":id options must be true or nil: %s: %s",
1727
+ rb_grn_inspect(rb_option_id),
1728
+ rb_grn_inspect(rb_ary_new3(2,
1729
+ self,
1730
+ rb_ary_new4(argc, argv))));
1731
+ }
1585
1732
  }
1586
1733
 
1587
1734
  return rb_grn_table_set_column_value(self, rb_id, rb_name, rb_value);
@@ -1609,16 +1756,16 @@ rb_grn_table_unlock (int argc, VALUE *argv, VALUE self)
1609
1756
  rb_scan_args(argc, argv, "01", &options);
1610
1757
 
1611
1758
  rb_grn_table_deconstruct(SELF(self), &table, &context,
1612
- NULL, NULL,
1613
- NULL, NULL, NULL,
1614
- NULL);
1759
+ NULL, NULL,
1760
+ NULL, NULL, NULL,
1761
+ NULL);
1615
1762
 
1616
1763
  rb_grn_scan_options(options,
1617
- "id", &rb_id,
1618
- NULL);
1764
+ "id", &rb_id,
1765
+ NULL);
1619
1766
 
1620
1767
  if (!NIL_P(rb_id))
1621
- id = NUM2UINT(rb_id);
1768
+ id = NUM2UINT(rb_id);
1622
1769
 
1623
1770
  rc = grn_obj_unlock(context, table, id);
1624
1771
  rb_grn_context_check(context, self);
@@ -1674,29 +1821,29 @@ rb_grn_table_lock (int argc, VALUE *argv, VALUE self)
1674
1821
  rb_scan_args(argc, argv, "01", &options);
1675
1822
 
1676
1823
  rb_grn_table_deconstruct(SELF(self), &table, &context,
1677
- NULL, NULL,
1678
- NULL, NULL, NULL,
1679
- NULL);
1824
+ NULL, NULL,
1825
+ NULL, NULL, NULL,
1826
+ NULL);
1680
1827
 
1681
1828
  rb_grn_scan_options(options,
1682
- "timeout", &rb_timeout,
1683
- "id", &rb_id,
1684
- NULL);
1829
+ "timeout", &rb_timeout,
1830
+ "id", &rb_id,
1831
+ NULL);
1685
1832
 
1686
1833
  if (!NIL_P(rb_timeout))
1687
- timeout = NUM2UINT(rb_timeout);
1834
+ timeout = NUM2UINT(rb_timeout);
1688
1835
 
1689
1836
  if (!NIL_P(rb_id))
1690
- id = NUM2UINT(rb_id);
1837
+ id = NUM2UINT(rb_id);
1691
1838
 
1692
1839
  rc = grn_obj_lock(context, table, id, timeout);
1693
1840
  rb_grn_context_check(context, self);
1694
1841
  rb_grn_rc_check(rc, self);
1695
1842
 
1696
1843
  if (rb_block_given_p()) {
1697
- return rb_ensure(rb_yield, Qnil, rb_grn_table_unlock_ensure, self);
1844
+ return rb_ensure(rb_yield, Qnil, rb_grn_table_unlock_ensure, self);
1698
1845
  } else {
1699
- return Qnil;
1846
+ return Qnil;
1700
1847
  }
1701
1848
  }
1702
1849
 
@@ -1723,16 +1870,16 @@ rb_grn_table_clear_lock (int argc, VALUE *argv, VALUE self)
1723
1870
  rb_scan_args(argc, argv, "01", &options);
1724
1871
 
1725
1872
  rb_grn_table_deconstruct(SELF(self), &table, &context,
1726
- NULL, NULL,
1727
- NULL, NULL, NULL,
1728
- NULL);
1873
+ NULL, NULL,
1874
+ NULL, NULL, NULL,
1875
+ NULL);
1729
1876
 
1730
1877
  rb_grn_scan_options(options,
1731
- "id", &rb_id,
1732
- NULL);
1878
+ "id", &rb_id,
1879
+ NULL);
1733
1880
 
1734
1881
  if (!NIL_P(rb_id))
1735
- id = NUM2UINT(rb_id);
1882
+ id = NUM2UINT(rb_id);
1736
1883
 
1737
1884
  grn_obj_clear_lock(context, table);
1738
1885
 
@@ -1762,16 +1909,16 @@ rb_grn_table_is_locked (int argc, VALUE *argv, VALUE self)
1762
1909
  rb_scan_args(argc, argv, "01", &options);
1763
1910
 
1764
1911
  rb_grn_table_deconstruct(SELF(self), &table, &context,
1765
- NULL, NULL,
1766
- NULL, NULL, NULL,
1767
- NULL);
1912
+ NULL, NULL,
1913
+ NULL, NULL, NULL,
1914
+ NULL);
1768
1915
 
1769
1916
  rb_grn_scan_options(options,
1770
- "id", &rb_id,
1771
- NULL);
1917
+ "id", &rb_id,
1918
+ NULL);
1772
1919
 
1773
1920
  if (!NIL_P(rb_id))
1774
- id = NUM2UINT(rb_id);
1921
+ id = NUM2UINT(rb_id);
1775
1922
 
1776
1923
  return CBOOL2RVAL(grn_obj_is_locked(context, table));
1777
1924
  }
@@ -1924,48 +2071,48 @@ rb_grn_table_select (int argc, VALUE *argv, VALUE self)
1924
2071
  rb_scan_args(argc, argv, "02", &condition_or_options, &options);
1925
2072
 
1926
2073
  rb_grn_table_deconstruct(SELF(self), &table, &context,
1927
- NULL, NULL,
1928
- NULL, NULL, NULL,
1929
- NULL);
2074
+ NULL, NULL,
2075
+ NULL, NULL, NULL,
2076
+ NULL);
1930
2077
 
1931
2078
  if (RVAL2CBOOL(rb_obj_is_kind_of(condition_or_options, rb_cString))) {
1932
- rb_query = condition_or_options;
2079
+ rb_query = condition_or_options;
1933
2080
  } else if (RVAL2CBOOL(rb_obj_is_kind_of(condition_or_options,
1934
- rb_cGrnExpression))) {
1935
- rb_expression = condition_or_options;
2081
+ rb_cGrnExpression))) {
2082
+ rb_expression = condition_or_options;
1936
2083
  } else {
1937
- if (!NIL_P(options))
1938
- rb_raise(rb_eArgError,
1939
- "should be [query_string, option_hash], "
1940
- "[expression, opion_hash] "
1941
- "or [option_hash]: %s",
1942
- rb_grn_inspect(rb_ary_new4(argc, argv)));
1943
- options = condition_or_options;
2084
+ if (!NIL_P(options))
2085
+ rb_raise(rb_eArgError,
2086
+ "should be [query_string, option_hash], "
2087
+ "[expression, opion_hash] "
2088
+ "or [option_hash]: %s",
2089
+ rb_grn_inspect(rb_ary_new4(argc, argv)));
2090
+ options = condition_or_options;
1944
2091
  }
1945
2092
 
1946
2093
  rb_grn_scan_options(options,
1947
- "operator", &rb_operator,
1948
- "result", &rb_result,
1949
- "name", &rb_name,
1950
- "syntax", &rb_syntax,
1951
- "allow_pragma", &rb_allow_pragma,
1952
- "allow_column", &rb_allow_column,
1953
- "allow_update", &rb_allow_update,
1954
- "allow_leading_not", &rb_allow_leading_not,
1955
- "default_column", &rb_default_column,
1956
- NULL);
2094
+ "operator", &rb_operator,
2095
+ "result", &rb_result,
2096
+ "name", &rb_name,
2097
+ "syntax", &rb_syntax,
2098
+ "allow_pragma", &rb_allow_pragma,
2099
+ "allow_column", &rb_allow_column,
2100
+ "allow_update", &rb_allow_update,
2101
+ "allow_leading_not", &rb_allow_leading_not,
2102
+ "default_column", &rb_default_column,
2103
+ NULL);
1957
2104
 
1958
2105
  if (!NIL_P(rb_operator))
1959
- operator = NUM2INT(rb_operator);
2106
+ operator = NUM2INT(rb_operator);
1960
2107
 
1961
2108
  if (NIL_P(rb_result)) {
1962
- result = grn_table_create(context, NULL, 0, NULL,
1963
- GRN_TABLE_HASH_KEY | GRN_OBJ_WITH_SUBREC,
1964
- table,
1965
- NULL);
1966
- rb_result = GRNTABLE2RVAL(context, result, GRN_TRUE);
2109
+ result = grn_table_create(context, NULL, 0, NULL,
2110
+ GRN_TABLE_HASH_KEY | GRN_OBJ_WITH_SUBREC,
2111
+ table,
2112
+ NULL);
2113
+ rb_result = GRNTABLE2RVAL(context, result, GRN_TRUE);
1967
2114
  } else {
1968
- result = RVAL2GRNTABLE(rb_result, &context);
2115
+ result = RVAL2GRNTABLE(rb_result, &context);
1969
2116
  }
1970
2117
 
1971
2118
  if (NIL_P(rb_expression)) {
@@ -1981,14 +2128,14 @@ rb_grn_table_select (int argc, VALUE *argv, VALUE self)
1981
2128
  }
1982
2129
  rb_grn_object_deconstruct(RB_GRN_OBJECT(DATA_PTR(rb_expression)),
1983
2130
  &expression, NULL,
1984
- NULL, NULL, NULL, NULL);
2131
+ NULL, NULL, NULL, NULL);
1985
2132
 
1986
2133
  grn_table_select(context, table, expression, result, operator);
1987
2134
  rb_grn_context_check(context, self);
1988
2135
 
1989
2136
  rb_attr(rb_singleton_class(rb_result),
1990
- rb_intern("expression"),
1991
- GRN_TRUE, GRN_FALSE, GRN_FALSE);
2137
+ rb_intern("expression"),
2138
+ GRN_TRUE, GRN_FALSE, GRN_FALSE);
1992
2139
  rb_iv_set(rb_result, "@expression", rb_expression);
1993
2140
 
1994
2141
  return rb_result;
@@ -1996,20 +2143,20 @@ rb_grn_table_select (int argc, VALUE *argv, VALUE self)
1996
2143
 
1997
2144
  static VALUE
1998
2145
  rb_grn_table_set_operation_bang (VALUE self, VALUE rb_other,
1999
- grn_operator operator)
2146
+ grn_operator operator)
2000
2147
  {
2001
2148
  grn_ctx *context;
2002
2149
  grn_obj *table, *other;
2003
2150
  grn_rc rc;
2004
2151
 
2005
2152
  rb_grn_table_deconstruct(SELF(self), &table, &context,
2006
- NULL, NULL,
2007
- NULL, NULL, NULL,
2008
- NULL);
2153
+ NULL, NULL,
2154
+ NULL, NULL, NULL,
2155
+ NULL);
2009
2156
  rb_grn_table_deconstruct(SELF(rb_other), &other, NULL,
2010
- NULL, NULL,
2011
- NULL, NULL, NULL,
2012
- NULL);
2157
+ NULL, NULL,
2158
+ NULL, NULL, NULL,
2159
+ NULL);
2013
2160
 
2014
2161
  rc = grn_table_setoperation(context, table, other, table, operator);
2015
2162
  rb_grn_context_check(context, self);
@@ -2096,9 +2243,9 @@ rb_grn_table_support_sub_records_p (VALUE self)
2096
2243
  grn_obj *table;
2097
2244
 
2098
2245
  rb_grn_table_deconstruct(SELF(self), &table, NULL,
2099
- NULL, NULL,
2100
- NULL, NULL, NULL,
2101
- NULL);
2246
+ NULL, NULL,
2247
+ NULL, NULL, NULL,
2248
+ NULL);
2102
2249
  return CBOOL2RVAL(table->header.flags & GRN_OBJ_WITH_SUBREC);
2103
2250
  }
2104
2251
 
@@ -2118,9 +2265,9 @@ rb_grn_table_exist_p (VALUE self, VALUE id)
2118
2265
  grn_obj *table;
2119
2266
 
2120
2267
  rb_grn_table_deconstruct(SELF(self), &table, &context,
2121
- NULL, NULL,
2122
- NULL, NULL, NULL,
2123
- NULL);
2268
+ NULL, NULL,
2269
+ NULL, NULL, NULL,
2270
+ NULL);
2124
2271
  return CBOOL2RVAL(grn_table_at(context, table, NUM2UINT(id)));
2125
2272
  }
2126
2273
 
@@ -2148,16 +2295,16 @@ rb_grn_table_defrag (int argc, VALUE *argv, VALUE self)
2148
2295
 
2149
2296
  rb_scan_args(argc, argv, "01", &options);
2150
2297
  rb_grn_scan_options(options,
2151
- "threshold", &rb_threshold,
2152
- NULL);
2298
+ "threshold", &rb_threshold,
2299
+ NULL);
2153
2300
  if (!NIL_P(rb_threshold)) {
2154
- threshold = NUM2INT(rb_threshold);
2301
+ threshold = NUM2INT(rb_threshold);
2155
2302
  }
2156
2303
 
2157
2304
  rb_grn_table_deconstruct(SELF(self), &table, &context,
2158
- NULL, NULL, NULL,
2159
- NULL, NULL,
2160
- NULL);
2305
+ NULL, NULL, NULL,
2306
+ NULL, NULL,
2307
+ NULL);
2161
2308
  n_segments = grn_obj_defrag(context, table, threshold);
2162
2309
  rb_grn_context_check(context, self);
2163
2310
 
@@ -2181,9 +2328,9 @@ rb_grn_table_rename (VALUE self, VALUE rb_name)
2181
2328
  int name_size;
2182
2329
 
2183
2330
  rb_grn_table_deconstruct(SELF(self), &table, &context,
2184
- NULL, NULL, NULL,
2185
- NULL, NULL,
2186
- NULL);
2331
+ NULL, NULL, NULL,
2332
+ NULL, NULL,
2333
+ NULL);
2187
2334
 
2188
2335
  name = StringValueCStr(rb_name);
2189
2336
  name_size = RSTRING_LEN(rb_name);
@@ -2211,15 +2358,15 @@ rb_grn_init_table (VALUE mGrn)
2211
2358
  rb_define_method(rb_cGrnTable, "inspect", rb_grn_table_inspect, 0);
2212
2359
 
2213
2360
  rb_define_method(rb_cGrnTable, "define_column",
2214
- rb_grn_table_define_column, -1);
2361
+ rb_grn_table_define_column, -1);
2215
2362
  rb_define_method(rb_cGrnTable, "define_index_column",
2216
- rb_grn_table_define_index_column, -1);
2363
+ rb_grn_table_define_index_column, -1);
2217
2364
  rb_define_method(rb_cGrnTable, "column",
2218
- rb_grn_table_get_column, 1);
2365
+ rb_grn_table_get_column, 1);
2219
2366
  rb_define_method(rb_cGrnTable, "columns",
2220
- rb_grn_table_get_columns, -1);
2367
+ rb_grn_table_get_columns, -1);
2221
2368
  rb_define_method(rb_cGrnTable, "have_column?",
2222
- rb_grn_table_have_column, 1);
2369
+ rb_grn_table_have_column, 1);
2223
2370
 
2224
2371
  rb_define_method(rb_cGrnTable, "open_cursor", rb_grn_table_open_cursor, -1);
2225
2372
  rb_define_method(rb_cGrnTable, "records", rb_grn_table_get_records, -1);
@@ -2239,13 +2386,13 @@ rb_grn_init_table (VALUE mGrn)
2239
2386
  rb_undef_method(rb_cGrnTable, "[]=");
2240
2387
 
2241
2388
  rb_define_method(rb_cGrnTable, "value",
2242
- rb_grn_table_get_value_convenience, -1);
2389
+ rb_grn_table_get_value_convenience, -1);
2243
2390
  rb_define_method(rb_cGrnTable, "set_value",
2244
- rb_grn_table_set_value_convenience, -1);
2391
+ rb_grn_table_set_value_convenience, -1);
2245
2392
  rb_define_method(rb_cGrnTable, "column_value",
2246
- rb_grn_table_get_column_value_convenience, -1);
2393
+ rb_grn_table_get_column_value_convenience, -1);
2247
2394
  rb_define_method(rb_cGrnTable, "set_column_value",
2248
- rb_grn_table_set_column_value_convenience, -1);
2395
+ rb_grn_table_set_column_value_convenience, -1);
2249
2396
 
2250
2397
  rb_define_method(rb_cGrnTable, "lock", rb_grn_table_lock, -1);
2251
2398
  rb_define_method(rb_cGrnTable, "unlock", rb_grn_table_unlock, -1);
@@ -2256,16 +2403,16 @@ rb_grn_init_table (VALUE mGrn)
2256
2403
 
2257
2404
  rb_define_method(rb_cGrnTable, "union!", rb_grn_table_union_bang, 1);
2258
2405
  rb_define_method(rb_cGrnTable, "intersection!",
2259
- rb_grn_table_intersection_bang, 1);
2406
+ rb_grn_table_intersection_bang, 1);
2260
2407
  rb_define_method(rb_cGrnTable, "difference!",
2261
- rb_grn_table_difference_bang, 1);
2408
+ rb_grn_table_difference_bang, 1);
2262
2409
  rb_define_method(rb_cGrnTable, "merge!",
2263
- rb_grn_table_merge_bang, 1);
2410
+ rb_grn_table_merge_bang, 1);
2264
2411
 
2265
2412
  rb_define_method(rb_cGrnTable, "support_key?",
2266
- rb_grn_table_support_key_p, 0);
2413
+ rb_grn_table_support_key_p, 0);
2267
2414
  rb_define_method(rb_cGrnTable, "support_sub_records?",
2268
- rb_grn_table_support_sub_records_p, 0);
2415
+ rb_grn_table_support_sub_records_p, 0);
2269
2416
 
2270
2417
  rb_define_method(rb_cGrnTable, "exist?", rb_grn_table_exist_p, 1);
2271
2418