null+****@clear*****
null+****@clear*****
2011年 6月 18日 (土) 14:07:18 JST
Kouhei Sutou 2011-06-18 05:07:18 +0000 (Sat, 18 Jun 2011) New Revision: 020be5daf61ded3d0a7edceff9353401303ac612 Log: [wrapper][write] get field data from key_part.field but not worked yet. :< Modified files: ha_mroonga.cc Modified: ha_mroonga.cc (+15 -12) =================================================================== --- ha_mroonga.cc 2011-06-18 02:05:03 +0000 (46d4004) +++ ha_mroonga.cc 2011-06-18 05:07:18 +0000 (ff38a08) @@ -2526,6 +2526,8 @@ int ha_mroonga::wrapper_write_row(uchar *buf) tmp_disable_binlog(thd); error = wrap_handler->ha_write_row(buf); reenable_binlog(thd); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); if (!error) { // TODO: extract as a method. @@ -2559,24 +2561,25 @@ int ha_mroonga::wrapper_write_row(uchar *buf) continue; } - Field *field = table->field[i]; - const char *column_name = field->field_name; + grn_obj *index_column = grn_index_columns[i]; - if (field->is_null()) - continue; + 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; - int column_size; - mrn_set_buf(ctx, field, &value, &column_size); - rc = grn_column_index_update(ctx, grn_index_columns[i], row_id, 1, - NULL, &value); - // TODO: check rc; + if (field->is_null()) + continue; + + int column_size; + mrn_set_buf(ctx, field, &value, &column_size); + rc = grn_column_index_update(ctx, index_column, row_id, 1, NULL, &value); + // TODO: check rc; + } } grn_obj_unlink(ctx, &value); } - MRN_SET_BASE_SHARE_KEY(share, table->s); - MRN_SET_BASE_TABLE_KEY(this, table); - DBUG_RETURN(error); }