rroonga 3.0.5 → 3.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. data/AUTHORS +5 -0
  2. data/Gemfile +20 -0
  3. data/Rakefile +187 -0
  4. data/doc/text/news.textile +10 -2
  5. data/doc/text/tutorial.textile +0 -2
  6. data/ext/groonga/extconf.rb +7 -1
  7. data/ext/groonga/rb-grn-accessor.c +11 -11
  8. data/ext/groonga/rb-grn-array.c +25 -25
  9. data/ext/groonga/rb-grn-column.c +106 -106
  10. data/ext/groonga/rb-grn-context.c +121 -121
  11. data/ext/groonga/rb-grn-database.c +78 -78
  12. data/ext/groonga/rb-grn-double-array-trie.c +92 -92
  13. data/ext/groonga/rb-grn-encoding-support.c +1 -1
  14. data/ext/groonga/rb-grn-encoding.c +28 -28
  15. data/ext/groonga/rb-grn-exception.c +9 -9
  16. data/ext/groonga/rb-grn-expression-builder.c +6 -6
  17. data/ext/groonga/rb-grn-expression.c +87 -87
  18. data/ext/groonga/rb-grn-fix-size-column.c +12 -12
  19. data/ext/groonga/rb-grn-geo-point.c +2 -2
  20. data/ext/groonga/rb-grn-hash.c +38 -38
  21. data/ext/groonga/rb-grn-index-column.c +191 -191
  22. data/ext/groonga/rb-grn-index-cursor.c +29 -29
  23. data/ext/groonga/rb-grn-logger.c +36 -36
  24. data/ext/groonga/rb-grn-normalizer.c +10 -10
  25. data/ext/groonga/rb-grn-patricia-trie.c +196 -196
  26. data/ext/groonga/rb-grn-plugin.c +5 -5
  27. data/ext/groonga/rb-grn-posting.c +2 -2
  28. data/ext/groonga/rb-grn-procedure.c +2 -2
  29. data/ext/groonga/rb-grn-query-logger.c +1 -1
  30. data/ext/groonga/rb-grn-record.c +1 -1
  31. data/ext/groonga/rb-grn-snippet.c +14 -14
  32. data/ext/groonga/rb-grn-table-cursor-key-support.c +4 -4
  33. data/ext/groonga/rb-grn-table-cursor.c +52 -52
  34. data/ext/groonga/rb-grn-table-key-support.c +209 -209
  35. data/ext/groonga/rb-grn-type.c +18 -18
  36. data/ext/groonga/rb-grn-utils.c +332 -314
  37. data/ext/groonga/rb-grn-variable-size-column.c +34 -34
  38. data/ext/groonga/rb-grn-variable.c +2 -2
  39. data/ext/groonga/rb-grn.h +240 -232
  40. data/ext/groonga/rb-groonga.c +10 -10
  41. data/rroonga-build.rb +7 -0
  42. data/rroonga.gemspec +1 -1
  43. data/test/test-hash.rb +4 -4
  44. data/test/test-index-column.rb +271 -257
  45. data/test/test-table-key-support.rb +78 -0
  46. data/test/test-table.rb +78 -51
  47. metadata +195 -164
  48. checksums.yaml +0 -7
@@ -31,49 +31,49 @@ VALUE rb_mGrnTableKeySupport;
31
31
 
32
32
  void
33
33
  rb_grn_table_key_support_deconstruct (RbGrnTableKeySupport *rb_grn_table_key_support,
34
- grn_obj **table_key_support,
35
- grn_ctx **context,
36
- grn_obj **key,
37
- grn_id *domain_id,
38
- grn_obj **domain,
39
- grn_obj **value,
40
- grn_id *range_id,
41
- grn_obj **range,
42
- VALUE *columns)
34
+ grn_obj **table_key_support,
35
+ grn_ctx **context,
36
+ grn_obj **key,
37
+ grn_id *domain_id,
38
+ grn_obj **domain,
39
+ grn_obj **value,
40
+ grn_id *range_id,
41
+ grn_obj **range,
42
+ VALUE *columns)
43
43
  {
44
44
  RbGrnTable *rb_grn_table;
45
45
 
46
46
  rb_grn_table = RB_GRN_TABLE(rb_grn_table_key_support);
47
47
 
48
48
  rb_grn_table_deconstruct(rb_grn_table, table_key_support, context,
49
- domain_id, domain,
50
- value, range_id, range,
51
- columns);
49
+ domain_id, domain,
50
+ value, range_id, range,
51
+ columns);
52
52
 
53
53
  if (key)
54
- *key = rb_grn_table_key_support->key;
54
+ *key = rb_grn_table_key_support->key;
55
55
  }
56
56
 
57
57
  void
58
58
  rb_grn_table_key_support_finalizer (grn_ctx *context,
59
- grn_obj *grn_object,
60
- RbGrnTableKeySupport *rb_grn_table_key_support)
59
+ grn_obj *grn_object,
60
+ RbGrnTableKeySupport *rb_grn_table_key_support)
61
61
  {
62
62
  if (!context)
63
- return;
63
+ return;
64
64
 
65
65
  if (rb_grn_table_key_support->key)
66
- grn_obj_unlink(context, rb_grn_table_key_support->key);
66
+ grn_obj_unlink(context, rb_grn_table_key_support->key);
67
67
  rb_grn_table_key_support->key = NULL;
68
68
 
69
69
  rb_grn_table_finalizer(context, grn_object,
70
- RB_GRN_TABLE(rb_grn_table_key_support));
70
+ RB_GRN_TABLE(rb_grn_table_key_support));
71
71
  }
72
72
 
73
73
  void
74
74
  rb_grn_table_key_support_bind (RbGrnTableKeySupport *rb_grn_table_key_support,
75
- grn_ctx *context,
76
- grn_obj *table_key_support)
75
+ grn_ctx *context,
76
+ grn_obj *table_key_support)
77
77
  {
78
78
  RbGrnObject *rb_grn_object;
79
79
  RbGrnTable *rb_grn_table;
@@ -84,7 +84,7 @@ rb_grn_table_key_support_bind (RbGrnTableKeySupport *rb_grn_table_key_support,
84
84
  rb_grn_table_bind(rb_grn_table, context, table_key_support);
85
85
 
86
86
  rb_grn_table_key_support->key =
87
- grn_obj_open(context, GRN_BULK, 0, rb_grn_object->domain_id);
87
+ grn_obj_open(context, GRN_BULK, 0, rb_grn_object->domain_id);
88
88
  }
89
89
 
90
90
  static VALUE
@@ -96,66 +96,66 @@ rb_grn_table_key_support_inspect_content (VALUE self, VALUE inspected)
96
96
 
97
97
  rb_grn_table = SELF(self);
98
98
  if (!rb_grn_table)
99
- return inspected;
99
+ return inspected;
100
100
 
101
101
  rb_grn_table_key_support_deconstruct(SELF(self), &table, &context,
102
- NULL, NULL, NULL,
103
- NULL, NULL, NULL,
104
- NULL);
102
+ NULL, NULL, NULL,
103
+ NULL, NULL, NULL,
104
+ NULL);
105
105
  if (!table)
106
- return inspected;
106
+ return inspected;
107
107
  if (!context)
108
- return inspected;
108
+ return inspected;
109
109
 
110
110
  {
111
- grn_obj value;
112
- grn_encoding encoding;
113
-
114
- rb_str_cat2(inspected, ", ");
115
- rb_str_cat2(inspected, "encoding: <");
116
- GRN_OBJ_INIT(&value, GRN_BULK, 0, GRN_ID_NIL);
117
- grn_obj_get_info(context, table, GRN_INFO_ENCODING, &value);
118
- encoding = *((grn_encoding *)GRN_BULK_HEAD(&value));
119
- grn_obj_unlink(context, &value);
120
-
121
- if (context->rc == GRN_SUCCESS) {
122
- rb_str_concat(inspected, rb_inspect(GRNENCODING2RVAL(encoding)));
123
- } else {
124
- rb_str_cat2(inspected, "invalid");
125
- }
126
-
127
- rb_str_cat2(inspected, ">");
111
+ grn_obj value;
112
+ grn_encoding encoding;
113
+
114
+ rb_str_cat2(inspected, ", ");
115
+ rb_str_cat2(inspected, "encoding: <");
116
+ GRN_OBJ_INIT(&value, GRN_BULK, 0, GRN_ID_NIL);
117
+ grn_obj_get_info(context, table, GRN_INFO_ENCODING, &value);
118
+ encoding = *((grn_encoding *)GRN_BULK_HEAD(&value));
119
+ grn_obj_unlink(context, &value);
120
+
121
+ if (context->rc == GRN_SUCCESS) {
122
+ rb_str_concat(inspected, rb_inspect(GRNENCODING2RVAL(encoding)));
123
+ } else {
124
+ rb_str_cat2(inspected, "invalid");
125
+ }
126
+
127
+ rb_str_cat2(inspected, ">");
128
128
  }
129
129
 
130
130
  {
131
- grn_obj *default_tokenizer;
132
-
133
- rb_str_cat2(inspected, ", ");
134
- rb_str_cat2(inspected, "default_tokenizer: ");
135
- default_tokenizer = grn_obj_get_info(context, table,
136
- GRN_INFO_DEFAULT_TOKENIZER,
137
- NULL);
138
- if (default_tokenizer) {
139
- rb_grn_object_inspect_object_content_name(inspected, context,
140
- default_tokenizer);
141
- } else {
142
- rb_str_cat2(inspected, "(nil)");
143
- }
131
+ grn_obj *default_tokenizer;
132
+
133
+ rb_str_cat2(inspected, ", ");
134
+ rb_str_cat2(inspected, "default_tokenizer: ");
135
+ default_tokenizer = grn_obj_get_info(context, table,
136
+ GRN_INFO_DEFAULT_TOKENIZER,
137
+ NULL);
138
+ if (default_tokenizer) {
139
+ rb_grn_object_inspect_object_content_name(inspected, context,
140
+ default_tokenizer);
141
+ } else {
142
+ rb_str_cat2(inspected, "(nil)");
143
+ }
144
144
  }
145
145
 
146
146
  {
147
- grn_obj *normalizer;
148
-
149
- rb_str_cat2(inspected, ", ");
150
- rb_str_cat2(inspected, "normalizer: ");
151
- normalizer = grn_obj_get_info(context, table, GRN_INFO_NORMALIZER,
152
- NULL);
153
- if (normalizer) {
154
- rb_grn_object_inspect_object_content_name(inspected, context,
155
- normalizer);
156
- } else {
157
- rb_str_cat2(inspected, "(nil)");
158
- }
147
+ grn_obj *normalizer;
148
+
149
+ rb_str_cat2(inspected, ", ");
150
+ rb_str_cat2(inspected, "normalizer: ");
151
+ normalizer = grn_obj_get_info(context, table, GRN_INFO_NORMALIZER,
152
+ NULL);
153
+ if (normalizer) {
154
+ rb_grn_object_inspect_object_content_name(inspected, context,
155
+ normalizer);
156
+ } else {
157
+ rb_str_cat2(inspected, "(nil)");
158
+ }
159
159
  }
160
160
 
161
161
  return inspected;
@@ -191,9 +191,9 @@ rb_grn_table_key_support_add_raw (VALUE self, VALUE rb_key, int *added)
191
191
  grn_obj *key, *domain;
192
192
 
193
193
  rb_grn_table_key_support_deconstruct(SELF(self), &table, &context,
194
- &key, &domain_id, &domain,
195
- NULL, NULL, NULL,
196
- NULL);
194
+ &key, &domain_id, &domain,
195
+ NULL, NULL, NULL,
196
+ NULL);
197
197
 
198
198
  GRN_BULK_REWIND(key);
199
199
  RVAL2GRNKEY(rb_key, context, key, domain_id, domain, self);
@@ -231,13 +231,13 @@ rb_grn_table_key_support_add (int argc, VALUE *argv, VALUE self)
231
231
  rb_scan_args(argc, argv, "11", &key, &values);
232
232
  id = rb_grn_table_key_support_add_raw(self, key, &added);
233
233
  if (GRN_ID_NIL == id) {
234
- return Qnil;
234
+ return Qnil;
235
235
  } else {
236
- if (added) {
237
- return rb_grn_record_new_added(self, id, values);
238
- } else {
239
- return rb_grn_record_new(self, id, values);
240
- }
236
+ if (added) {
237
+ return rb_grn_record_new_added(self, id, values);
238
+ } else {
239
+ return rb_grn_record_new(self, id, values);
240
+ }
241
241
  }
242
242
  }
243
243
 
@@ -249,9 +249,9 @@ rb_grn_table_key_support_get (VALUE self, VALUE rb_key)
249
249
  grn_id id, domain_id;
250
250
 
251
251
  rb_grn_table_key_support_deconstruct(SELF(self), &table, &context,
252
- &key, &domain_id, &domain,
253
- NULL, NULL, NULL,
254
- NULL);
252
+ &key, &domain_id, &domain,
253
+ NULL, NULL, NULL,
254
+ NULL);
255
255
 
256
256
  GRN_BULK_REWIND(key);
257
257
  RVAL2GRNKEY(rb_key, context, key, domain_id, domain, self);
@@ -280,16 +280,16 @@ rb_grn_table_key_support_get_id (int argc, VALUE *argv, VALUE self)
280
280
 
281
281
  rb_scan_args(argc, argv, "01", &rb_key);
282
282
  if (NIL_P(rb_key)) {
283
- return rb_grn_object_get_id(self);
283
+ return rb_grn_object_get_id(self);
284
284
  } else {
285
- grn_id id;
286
-
287
- id = rb_grn_table_key_support_get(self, rb_key);
288
- if (id == GRN_ID_NIL) {
289
- return Qnil;
290
- } else {
291
- return UINT2NUM(id);
292
- }
285
+ grn_id id;
286
+
287
+ id = rb_grn_table_key_support_get(self, rb_key);
288
+ if (id == GRN_ID_NIL) {
289
+ return Qnil;
290
+ } else {
291
+ return UINT2NUM(id);
292
+ }
293
293
  }
294
294
  }
295
295
 
@@ -309,20 +309,20 @@ rb_grn_table_key_support_get_key (VALUE self, VALUE rb_id)
309
309
  VALUE rb_key;
310
310
 
311
311
  rb_grn_table_key_support_deconstruct(SELF(self), &table, &context,
312
- &key, NULL, NULL,
313
- NULL, NULL, NULL,
314
- NULL);
312
+ &key, NULL, NULL,
313
+ NULL, NULL, NULL,
314
+ NULL);
315
315
 
316
316
  id = NUM2UINT(rb_id);
317
317
  GRN_BULK_REWIND(key);
318
318
  key_size = grn_table_get_key(context, table, id,
319
- GRN_BULK_HEAD(key), GRN_BULK_VSIZE(key));
319
+ GRN_BULK_HEAD(key), GRN_BULK_VSIZE(key));
320
320
  if (key_size == 0)
321
- return Qnil;
321
+ return Qnil;
322
322
 
323
323
  if (GRN_BULK_VSIZE(key) < key_size) {
324
- grn_bulk_reserve(context, key, key_size);
325
- grn_table_get_key(context, table, id, GRN_BULK_HEAD(key), key_size);
324
+ grn_bulk_reserve(context, key, key_size);
325
+ grn_table_get_key(context, table, id, GRN_BULK_HEAD(key), key_size);
326
326
  }
327
327
 
328
328
  rb_key = GRNKEY2RVAL(context, GRN_BULK_HEAD(key), key_size, table, self);
@@ -342,9 +342,9 @@ rb_grn_table_key_support_has_key (VALUE self, VALUE rb_key)
342
342
  grn_id id, domain_id;
343
343
 
344
344
  rb_grn_table_key_support_deconstruct(SELF(self), &table, &context,
345
- &key, &domain_id, &domain,
346
- NULL, NULL, NULL,
347
- NULL);
345
+ &key, &domain_id, &domain,
346
+ NULL, NULL, NULL,
347
+ NULL);
348
348
 
349
349
  GRN_BULK_REWIND(key);
350
350
  RVAL2GRNKEY(rb_key, context, key, domain_id, domain, self);
@@ -363,14 +363,14 @@ rb_grn_table_key_support_delete_by_key (VALUE self, VALUE rb_key)
363
363
  grn_rc rc;
364
364
 
365
365
  rb_grn_table_key_support_deconstruct(SELF(self), &table, &context,
366
- &key, &domain_id, &domain,
367
- NULL, NULL, NULL,
368
- NULL);
366
+ &key, &domain_id, &domain,
367
+ NULL, NULL, NULL,
368
+ NULL);
369
369
 
370
370
  GRN_BULK_REWIND(key);
371
371
  RVAL2GRNKEY(rb_key, context, key, domain_id, domain, self);
372
372
  rc = grn_table_delete(context, table,
373
- GRN_BULK_HEAD(key), GRN_BULK_VSIZE(key));
373
+ GRN_BULK_HEAD(key), GRN_BULK_VSIZE(key));
374
374
  rb_grn_context_check(context, self);
375
375
  rb_grn_rc_check(rc, self);
376
376
 
@@ -408,14 +408,14 @@ rb_grn_table_key_support_delete (int argc, VALUE *argv, VALUE self)
408
408
  VALUE rb_id_or_key;
409
409
 
410
410
  if (rb_block_given_p()) {
411
- return rb_grn_table_delete_by_expression(self);
411
+ return rb_grn_table_delete_by_expression(self);
412
412
  }
413
413
 
414
414
  rb_scan_args(argc, argv, "1", &rb_id_or_key);
415
415
  if (FIXNUM_P(rb_id_or_key)) {
416
- return rb_grn_table_delete_by_id(self, rb_id_or_key);
416
+ return rb_grn_table_delete_by_id(self, rb_id_or_key);
417
417
  } else {
418
- return rb_grn_table_key_support_delete_by_key(self, rb_id_or_key);
418
+ return rb_grn_table_key_support_delete_by_key(self, rb_id_or_key);
419
419
  }
420
420
  }
421
421
 
@@ -434,9 +434,9 @@ rb_grn_table_key_support_array_reference (VALUE self, VALUE rb_key)
434
434
 
435
435
  id = rb_grn_table_key_support_get(self, rb_key);
436
436
  if (id == GRN_ID_NIL) {
437
- return Qnil;
437
+ return Qnil;
438
438
  } else {
439
- return rb_grn_record_new(self, id, Qnil);
439
+ return rb_grn_record_new(self, id, Qnil);
440
440
  }
441
441
  }
442
442
 
@@ -459,14 +459,14 @@ set_value (VALUE args, SetValueData *data)
459
459
 
460
460
  rb_column = rb_grn_table_get_column(data->self, rb_name);
461
461
  if (NIL_P(rb_column)) {
462
- rb_raise(rb_eGrnNoSuchColumn,
463
- "no such column: <%s>: <%s>",
464
- rb_grn_inspect(rb_name), rb_grn_inspect(data->self));
462
+ rb_raise(rb_eGrnNoSuchColumn,
463
+ "no such column: <%s>: <%s>",
464
+ rb_grn_inspect(rb_name), rb_grn_inspect(data->self));
465
465
  }
466
466
 
467
467
  rb_grn_object = RB_GRN_OBJECT(DATA_PTR(rb_column));
468
468
  return rb_grn_object_set_raw(rb_grn_object,
469
- data->id, rb_value, GRN_OBJ_SET, data->self);
469
+ data->id, rb_value, GRN_OBJ_SET, data->self);
470
470
  }
471
471
 
472
472
  /*
@@ -488,16 +488,16 @@ rb_grn_table_key_support_array_set (VALUE self, VALUE rb_key, VALUE rb_values)
488
488
  grn_obj *table;
489
489
 
490
490
  rb_grn_table_key_support_deconstruct(SELF(self), &table, &context,
491
- NULL, NULL, NULL,
492
- NULL, NULL, NULL,
493
- NULL);
491
+ NULL, NULL, NULL,
492
+ NULL, NULL, NULL,
493
+ NULL);
494
494
 
495
495
  id = rb_grn_table_key_support_add_raw(self, rb_key, NULL);
496
496
 
497
497
  if (id == GRN_ID_NIL) {
498
- rb_raise(rb_eGrnError,
499
- "failed to add record: %s",
500
- rb_grn_inspect(rb_ary_new3(3, self, rb_key, rb_values)));
498
+ rb_raise(rb_eGrnError,
499
+ "failed to add record: %s",
500
+ rb_grn_inspect(rb_ary_new3(3, self, rb_key, rb_values)));
501
501
  }
502
502
 
503
503
  data.self = self;
@@ -523,26 +523,26 @@ rb_grn_table_key_support_set_column_value (int argc, VALUE *argv, VALUE self)
523
523
  VALUE rb_key, rb_id_or_key, rb_name, rb_value, rb_options;
524
524
 
525
525
  rb_scan_args(argc, argv, "31",
526
- &rb_id_or_key, &rb_name, &rb_value, &rb_options);
526
+ &rb_id_or_key, &rb_name, &rb_value, &rb_options);
527
527
  if (!NIL_P(rb_options)) {
528
- VALUE rb_option_id;
529
- rb_grn_scan_options(rb_options,
530
- "id", &rb_option_id,
531
- NULL);
532
- if (RVAL2CBOOL(rb_option_id)) {
533
- VALUE rb_id = rb_id_or_key;
534
- return rb_grn_table_set_column_value(self, rb_id, rb_name, rb_value);
535
- }
528
+ VALUE rb_option_id;
529
+ rb_grn_scan_options(rb_options,
530
+ "id", &rb_option_id,
531
+ NULL);
532
+ if (RVAL2CBOOL(rb_option_id)) {
533
+ VALUE rb_id = rb_id_or_key;
534
+ return rb_grn_table_set_column_value(self, rb_id, rb_name, rb_value);
535
+ }
536
536
  }
537
537
 
538
538
  rb_key = rb_id_or_key;
539
539
  id = rb_grn_table_key_support_add_raw(self, rb_key, NULL);
540
540
  if (id == GRN_ID_NIL) {
541
- rb_raise(rb_eGrnError,
542
- "failed to add record: %s",
543
- rb_grn_inspect(rb_ary_new3(4,
544
- self, rb_key,
545
- rb_name, rb_value)));
541
+ rb_raise(rb_eGrnError,
542
+ "failed to add record: %s",
543
+ rb_grn_inspect(rb_ary_new3(4,
544
+ self, rb_key,
545
+ rb_name, rb_value)));
546
546
  }
547
547
 
548
548
  return rb_grn_table_set_column_value_raw(self, id, rb_name, rb_value);
@@ -564,20 +564,20 @@ rb_grn_table_key_support_get_column_value (int argc, VALUE *argv, VALUE self)
564
564
 
565
565
  rb_scan_args(argc, argv, "21", &rb_id_or_key, &rb_name, &rb_options);
566
566
  if (!NIL_P(rb_options)) {
567
- VALUE rb_option_id;
568
- rb_grn_scan_options(rb_options,
569
- "id", &rb_option_id,
570
- NULL);
571
- if (RVAL2CBOOL(rb_option_id)) {
572
- VALUE rb_id = rb_id_or_key;
573
- return rb_grn_table_get_column_value(self, rb_id, rb_name);
574
- }
567
+ VALUE rb_option_id;
568
+ rb_grn_scan_options(rb_options,
569
+ "id", &rb_option_id,
570
+ NULL);
571
+ if (RVAL2CBOOL(rb_option_id)) {
572
+ VALUE rb_id = rb_id_or_key;
573
+ return rb_grn_table_get_column_value(self, rb_id, rb_name);
574
+ }
575
575
  }
576
576
 
577
577
  rb_key = rb_id_or_key;
578
578
  id = rb_grn_table_key_support_get(self, rb_key);
579
579
  if (id == GRN_ID_NIL) {
580
- return Qnil;
580
+ return Qnil;
581
581
  }
582
582
 
583
583
  return rb_grn_table_get_column_value_raw(self, id, rb_name);
@@ -593,12 +593,12 @@ rb_grn_table_key_support_get_value_by_key (VALUE self, VALUE rb_key)
593
593
  id = rb_grn_table_key_support_get(self, rb_key);
594
594
 
595
595
  if (id == GRN_ID_NIL)
596
- return Qnil;
596
+ return Qnil;
597
597
 
598
598
  rb_grn_table_key_support_deconstruct(SELF(self), &table, &context,
599
- NULL, NULL, NULL,
600
- &value, NULL, &range,
601
- NULL);
599
+ NULL, NULL, NULL,
600
+ &value, NULL, &range,
601
+ NULL);
602
602
  GRN_BULK_REWIND(value);
603
603
  grn_obj_get_value(context, table, id, value);
604
604
  rb_grn_context_check(context, self);
@@ -622,26 +622,26 @@ rb_grn_table_key_support_get_value (int argc, VALUE *argv, VALUE self)
622
622
  rb_scan_args(argc, argv, "11", &rb_id_or_key, &rb_options);
623
623
 
624
624
  if (NIL_P(rb_options)) {
625
- use_key = GRN_TRUE;
625
+ use_key = GRN_TRUE;
626
626
  } else {
627
- VALUE rb_option_id;
627
+ VALUE rb_option_id;
628
628
 
629
- rb_grn_scan_options(rb_options,
630
- "id", &rb_option_id,
631
- NULL);
632
- use_key = !RVAL2CBOOL(rb_option_id);
629
+ rb_grn_scan_options(rb_options,
630
+ "id", &rb_option_id,
631
+ NULL);
632
+ use_key = !RVAL2CBOOL(rb_option_id);
633
633
  }
634
634
 
635
635
  if (use_key) {
636
- return rb_grn_table_key_support_get_value_by_key(self, rb_id_or_key);
636
+ return rb_grn_table_key_support_get_value_by_key(self, rb_id_or_key);
637
637
  } else {
638
- return rb_grn_table_get_value(self, rb_id_or_key);
638
+ return rb_grn_table_get_value(self, rb_id_or_key);
639
639
  }
640
640
  }
641
641
 
642
642
  static VALUE
643
643
  rb_grn_table_key_support_set_value_by_key (VALUE self,
644
- VALUE rb_key, VALUE rb_value)
644
+ VALUE rb_key, VALUE rb_value)
645
645
  {
646
646
  grn_ctx *context;
647
647
  grn_obj *table;
@@ -650,21 +650,21 @@ rb_grn_table_key_support_set_value_by_key (VALUE self,
650
650
  grn_rc rc;
651
651
 
652
652
  if (NIL_P(rb_key)) {
653
- rb_raise(rb_eArgError, "key should not be nil: <%s>",
654
- rb_grn_inspect(self));
653
+ rb_raise(rb_eArgError, "key should not be nil: <%s>",
654
+ rb_grn_inspect(self));
655
655
  }
656
656
 
657
657
  rb_grn_table_key_support_deconstruct(SELF(self), &table, &context,
658
- NULL, NULL, NULL,
659
- &value, NULL, NULL,
660
- NULL);
658
+ NULL, NULL, NULL,
659
+ &value, NULL, NULL,
660
+ NULL);
661
661
 
662
662
  id = rb_grn_table_key_support_add_raw(self, rb_key, NULL);
663
663
  if (GRN_ID_NIL == id) {
664
- rb_raise(rb_eGrnError,
665
- "failed to add new record with key: <%s>: <%s>",
666
- rb_grn_inspect(rb_key),
667
- rb_grn_inspect(self));
664
+ rb_raise(rb_eGrnError,
665
+ "failed to add new record with key: <%s>: <%s>",
666
+ rb_grn_inspect(rb_key),
667
+ rb_grn_inspect(self));
668
668
  }
669
669
 
670
670
  GRN_BULK_REWIND(value);
@@ -692,22 +692,22 @@ rb_grn_table_key_support_set_value (int argc, VALUE *argv, VALUE self)
692
692
  rb_scan_args(argc, argv, "21", &rb_id_or_key, &rb_value, &rb_options);
693
693
 
694
694
  if (NIL_P(rb_options)) {
695
- use_key = GRN_TRUE;
695
+ use_key = GRN_TRUE;
696
696
  } else {
697
- VALUE rb_option_id;
697
+ VALUE rb_option_id;
698
698
 
699
- rb_grn_scan_options(rb_options,
700
- "id", &rb_option_id,
701
- NULL);
702
- use_key = !RVAL2CBOOL(rb_option_id);
699
+ rb_grn_scan_options(rb_options,
700
+ "id", &rb_option_id,
701
+ NULL);
702
+ use_key = !RVAL2CBOOL(rb_option_id);
703
703
  }
704
704
 
705
705
  if (use_key) {
706
- return rb_grn_table_key_support_set_value_by_key(self,
707
- rb_id_or_key,
708
- rb_value);
706
+ return rb_grn_table_key_support_set_value_by_key(self,
707
+ rb_id_or_key,
708
+ rb_value);
709
709
  } else {
710
- return rb_grn_table_set_value(self, rb_id_or_key, rb_value);
710
+ return rb_grn_table_set_value(self, rb_id_or_key, rb_value);
711
711
  }
712
712
  }
713
713
 
@@ -725,12 +725,12 @@ rb_grn_table_key_support_get_default_tokenizer (VALUE self)
725
725
  grn_obj *tokenizer = NULL;
726
726
 
727
727
  rb_grn_table_key_support_deconstruct(SELF(self), &table, &context,
728
- NULL, NULL, NULL,
729
- NULL, NULL, NULL,
730
- NULL);
728
+ NULL, NULL, NULL,
729
+ NULL, NULL, NULL,
730
+ NULL);
731
731
 
732
732
  tokenizer = grn_obj_get_info(context, table, GRN_INFO_DEFAULT_TOKENIZER,
733
- NULL);
733
+ NULL);
734
734
  rb_grn_context_check(context, self);
735
735
 
736
736
  return GRNOBJECT2RVAL(Qnil, context, tokenizer, GRN_FALSE);
@@ -766,13 +766,13 @@ rb_grn_table_key_support_set_default_tokenizer (VALUE self, VALUE rb_tokenizer)
766
766
  grn_rc rc;
767
767
 
768
768
  rb_grn_table_key_support_deconstruct(SELF(self), &table, &context,
769
- NULL, NULL, NULL,
770
- NULL, NULL, NULL,
771
- NULL);
769
+ NULL, NULL, NULL,
770
+ NULL, NULL, NULL,
771
+ NULL);
772
772
 
773
773
  tokenizer = RVAL2GRNOBJECT(rb_tokenizer, &context);
774
774
  rc = grn_obj_set_info(context, table,
775
- GRN_INFO_DEFAULT_TOKENIZER, tokenizer);
775
+ GRN_INFO_DEFAULT_TOKENIZER, tokenizer);
776
776
  rb_grn_context_check(context, self);
777
777
  rb_grn_rc_check(rc, self);
778
778
 
@@ -793,9 +793,9 @@ rb_grn_table_key_support_get_normalizer (VALUE self)
793
793
  grn_obj *normalizer = NULL;
794
794
 
795
795
  rb_grn_table_key_support_deconstruct(SELF(self), &table, &context,
796
- NULL, NULL, NULL,
797
- NULL, NULL, NULL,
798
- NULL);
796
+ NULL, NULL, NULL,
797
+ NULL, NULL, NULL,
798
+ NULL);
799
799
 
800
800
  normalizer = grn_obj_get_info(context, table, GRN_INFO_NORMALIZER, NULL);
801
801
  rb_grn_context_check(context, self);
@@ -832,9 +832,9 @@ rb_grn_table_key_support_set_normalizer (VALUE self, VALUE rb_normalizer)
832
832
  grn_rc rc;
833
833
 
834
834
  rb_grn_table_key_support_deconstruct(SELF(self), &table, &context,
835
- NULL, NULL, NULL,
836
- NULL, NULL, NULL,
837
- NULL);
835
+ NULL, NULL, NULL,
836
+ NULL, NULL, NULL,
837
+ NULL);
838
838
 
839
839
  normalizer = RVAL2GRNOBJECT(rb_normalizer, &context);
840
840
  rc = grn_obj_set_info(context, table, GRN_INFO_NORMALIZER, normalizer);
@@ -871,9 +871,9 @@ rb_grn_table_key_support_support_key_p (VALUE self)
871
871
  grn_obj *table;
872
872
 
873
873
  rb_grn_table_key_support_deconstruct(SELF(self), &table, NULL,
874
- NULL, NULL, NULL,
875
- NULL, NULL, NULL,
876
- NULL);
874
+ NULL, NULL, NULL,
875
+ NULL, NULL, NULL,
876
+ NULL);
877
877
  return table->header.domain == GRN_ID_NIL ? Qfalse : Qtrue;
878
878
  }
879
879
 
@@ -884,48 +884,48 @@ rb_grn_init_table_key_support (VALUE mGrn)
884
884
  rb_include_module(rb_mGrnTableKeySupport, rb_mGrnEncodingSupport);
885
885
 
886
886
  rb_define_method(rb_mGrnTableKeySupport, "inspect",
887
- rb_grn_table_key_support_inspect, 0);
887
+ rb_grn_table_key_support_inspect, 0);
888
888
 
889
889
  rb_define_method(rb_mGrnTableKeySupport, "add",
890
- rb_grn_table_key_support_add, -1);
890
+ rb_grn_table_key_support_add, -1);
891
891
  rb_define_method(rb_mGrnTableKeySupport, "id",
892
- rb_grn_table_key_support_get_id, -1);
892
+ rb_grn_table_key_support_get_id, -1);
893
893
  rb_define_method(rb_mGrnTableKeySupport, "key",
894
- rb_grn_table_key_support_get_key, 1);
894
+ rb_grn_table_key_support_get_key, 1);
895
895
  rb_define_method(rb_mGrnTableKeySupport, "has_key?",
896
- rb_grn_table_key_support_has_key, 1);
896
+ rb_grn_table_key_support_has_key, 1);
897
897
 
898
898
  rb_define_method(rb_mGrnTableKeySupport, "delete",
899
- rb_grn_table_key_support_delete, -1);
899
+ rb_grn_table_key_support_delete, -1);
900
900
 
901
901
  rb_define_method(rb_mGrnTableKeySupport, "[]",
902
- rb_grn_table_key_support_array_reference, 1);
902
+ rb_grn_table_key_support_array_reference, 1);
903
903
  rb_define_method(rb_mGrnTableKeySupport, "[]=",
904
- rb_grn_table_key_support_array_set, 2);
904
+ rb_grn_table_key_support_array_set, 2);
905
905
 
906
906
  rb_define_method(rb_mGrnTableKeySupport, "column_value",
907
- rb_grn_table_key_support_get_column_value, -1);
907
+ rb_grn_table_key_support_get_column_value, -1);
908
908
  rb_define_method(rb_mGrnTableKeySupport, "set_column_value",
909
- rb_grn_table_key_support_set_column_value, -1);
909
+ rb_grn_table_key_support_set_column_value, -1);
910
910
 
911
911
  rb_define_method(rb_mGrnTableKeySupport, "value",
912
- rb_grn_table_key_support_get_value, -1);
912
+ rb_grn_table_key_support_get_value, -1);
913
913
  rb_define_method(rb_mGrnTableKeySupport, "set_value",
914
- rb_grn_table_key_support_set_value, -1);
914
+ rb_grn_table_key_support_set_value, -1);
915
915
 
916
916
  rb_define_method(rb_mGrnTableKeySupport, "default_tokenizer",
917
- rb_grn_table_key_support_get_default_tokenizer, 0);
917
+ rb_grn_table_key_support_get_default_tokenizer, 0);
918
918
  rb_define_method(rb_mGrnTableKeySupport, "default_tokenizer=",
919
- rb_grn_table_key_support_set_default_tokenizer, 1);
919
+ rb_grn_table_key_support_set_default_tokenizer, 1);
920
920
 
921
921
  rb_define_method(rb_mGrnTableKeySupport, "normalizer",
922
- rb_grn_table_key_support_get_normalizer, 0);
922
+ rb_grn_table_key_support_get_normalizer, 0);
923
923
  rb_define_method(rb_mGrnTableKeySupport, "normalizer=",
924
- rb_grn_table_key_support_set_normalizer, 1);
924
+ rb_grn_table_key_support_set_normalizer, 1);
925
925
 
926
926
  rb_define_method(rb_mGrnTableKeySupport, "normalize_key?",
927
- rb_grn_table_key_support_normalize_key_p, 0);
927
+ rb_grn_table_key_support_normalize_key_p, 0);
928
928
 
929
929
  rb_define_method(rb_mGrnTableKeySupport, "support_key?",
930
- rb_grn_table_key_support_support_key_p, 0);
930
+ rb_grn_table_key_support_support_key_p, 0);
931
931
  }