void rb_grn_variable_size_column_bind (RbGrnVariableSizeColumn *rb_column, grn_ctx *context, grn_obj *column) { RbGrnObject *rb_grn_object; int column_type; unsigned char value_type; rb_grn_object = RB_GRN_OBJECT(rb_column); rb_grn_column_bind(RB_GRN_COLUMN(rb_column), context, column); rb_column->element_value = NULL; column_type = (column->header.flags & GRN_OBJ_COLUMN_TYPE_MASK); if (column_type != GRN_OBJ_COLUMN_VECTOR) { return; } switch (rb_grn_object->range->header.type) { case GRN_TABLE_HASH_KEY: case GRN_TABLE_PAT_KEY: case GRN_TABLE_DAT_KEY: case GRN_TABLE_NO_KEY: value_type = GRN_UVECTOR; break; default: value_type = GRN_VECTOR; break; } if (column->header.flags & GRN_OBJ_WITH_WEIGHT) { rb_column->element_value = grn_obj_open(context, value_type, 0, rb_grn_object->range_id); } }
void rb_grn_index_column_deconstruct (RbGrnIndexColumn *rb_grn_index_column, grn_obj **column, grn_ctx **context, grn_id *domain_id, grn_obj **domain, grn_obj **value, grn_obj **old_value, grn_id *range_id, grn_obj **range, grn_obj **id_query, grn_obj **string_query) { RbGrnObject *rb_grn_object; rb_grn_object = RB_GRN_OBJECT(rb_grn_index_column); rb_grn_column_deconstruct(RB_GRN_COLUMN(rb_grn_object), column, context, domain_id, domain, value, range_id, range); if (old_value) *old_value = rb_grn_index_column->old_value; if (id_query) *id_query = rb_grn_index_column->id_query; if (string_query) *string_query = rb_grn_index_column->string_query; }
void rb_grn_variable_size_column_finalizer (grn_ctx *context, grn_obj *grn_object, RbGrnVariableSizeColumn *rb_column) { rb_grn_column_finalizer(context, grn_object, RB_GRN_COLUMN(rb_column)); if (context && rb_column->element_value) grn_obj_unlink(context, rb_column->element_value); rb_column->element_value = NULL; }
void rb_grn_index_column_finalizer (grn_ctx *context, grn_obj *object, RbGrnIndexColumn *rb_grn_index_column) { if (!context) return; grn_obj_unlink(context, rb_grn_index_column->id_query); grn_obj_unlink(context, rb_grn_index_column->string_query); grn_obj_unlink(context, rb_grn_index_column->old_value); rb_grn_column_finalizer(context, object, RB_GRN_COLUMN(rb_grn_index_column)); }
void rb_grn_index_column_bind (RbGrnIndexColumn *rb_grn_index_column, grn_ctx *context, grn_obj *column) { RbGrnObject *rb_grn_object; rb_grn_column_bind(RB_GRN_COLUMN(rb_grn_index_column), context, column); rb_grn_object = RB_GRN_OBJECT(rb_grn_index_column); rb_grn_index_column->old_value = grn_obj_open(context, GRN_BULK, 0, rb_grn_object->range_id); rb_grn_index_column->id_query = grn_obj_open(context, GRN_BULK, 0, rb_grn_object->domain_id); rb_grn_index_column->string_query = grn_obj_open(context, GRN_BULK, GRN_OBJ_DO_SHALLOW_COPY, GRN_DB_SHORT_TEXT); }
static void rb_grn_variable_size_column_deconstruct (RbGrnVariableSizeColumn *rb_column, grn_obj **column, grn_ctx **context, grn_id *domain_id, grn_obj **domain, grn_obj **value, grn_obj **element_value, grn_id *range_id, grn_obj **range) { RbGrnColumn *rb_grn_column; rb_grn_column = RB_GRN_COLUMN(rb_column); rb_grn_column_deconstruct(rb_grn_column, column, context, domain_id, domain, value, range_id, range); if (element_value) *element_value = rb_column->element_value; }