Navigation Menu

Skip to content

Commit

Permalink
add pointer move in default_update_row
Browse files Browse the repository at this point in the history
  • Loading branch information
Kentoku committed Jun 18, 2011
1 parent bde46c1 commit dc731a4
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions ha_mroonga.cc
Expand Up @@ -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);
}

Expand Down

0 comments on commit dc731a4

Please sign in to comment.