Kentoku
null+****@clear*****
Thu Oct 4 10:25:31 JST 2012
Kentoku 2011-06-18 18:31:50 +0900 (Sat, 18 Jun 2011) New Revision: dc731a4439991b9ace4f2c86b200343b421fe362 https://github.com/mroonga/mroonga/commit/dc731a4439991b9ace4f2c86b200343b421fe362 Log: add pointer move in default_update_row Modified files: ha_mroonga.cc Modified: ha_mroonga.cc (+51 -0) =================================================================== --- ha_mroonga.cc 2011-06-18 18:29:52 +0900 (c7cf22b) +++ ha_mroonga.cc 2011-06-18 18:31:50 +0900 (cbc291f) @@ -2802,6 +2802,57 @@ int ha_mroonga::wrapper_update_row(const uchar *old_data, uchar *new_data) reenable_binlog(thd); MRN_SET_BASE_SHARE_KEY(share, table->s); MRN_SET_BASE_TABLE_KEY(this, table); + if (!error) + { + my_ptrdiff_t ptr_diff = PTR_BYTE_DIFF(old_data, table->record[0]); + + grn_obj key; + GRN_TEXT_INIT(&key, 0); + + grn_bulk_space(ctx, &key, table->key_info->key_length); + key_copy((uchar *)(GRN_TEXT_VALUE(&key)), + old_data, + &(table->key_info[table_share->primary_key]), + table->key_info[table_share->primary_key].key_length); + +#ifndef DBUG_OFF + my_bitmap_map *tmp_map = dbug_tmp_use_all_columns(table, table->read_set); +#endif + uint i; + uint n_keys = table->s->keys; + for (i = 0; i < n_keys; i++) { + grn_rc rc; + KEY key_info = table->key_info[i]; + + if (key_info.algorithm != HA_KEY_ALG_FULLTEXT) { + continue; + } + + grn_obj *index_column = grn_index_columns[i]; + + uint j; + for (j = 0; j < key_info.key_parts; j++) { + Field *field = key_info.key_part[j].field; + const char *column_name = field->field_name; + + field->move_field_offset(ptr_diff); + if (field->is_null()) + { + field->move_field_offset(-ptr_diff); + continue; + } + + int column_size; + mrn_set_buf(ctx, field, &value, &column_size); + rc = grn_column_index_update(ctx, index_column, record_id, 1, NULL, &value); + // TODO: check rc; + field->move_field_offset(-ptr_diff); + } + } +#ifndef DBUG_OFF + dbug_tmp_restore_column_map(table->read_set, tmp_map); +#endif + } DBUG_RETURN(error); } -------------- next part -------------- HTML����������������������������...Download