Commit ebafe5a2 authored by Marko Mäkelä's avatar Marko Mäkelä

Cleanup: Avoid repeated calls to dict_col_t::is_virtual()

parent 4a165f37
......@@ -5775,14 +5775,13 @@ innobase_vcol_build_templ(
mysql_row_templ_t* templ,
ulint col_no)
{
if (dict_col_is_virtual(col)) {
templ->is_virtual = true;
templ->col_no = col_no;
templ->col_no = col_no;
templ->is_virtual = col->is_virtual();
if (templ->is_virtual) {
templ->clust_rec_field_no = ULINT_UNDEFINED;
templ->rec_field_no = col->ind;
} else {
templ->is_virtual = false;
templ->col_no = col_no;
templ->clust_rec_field_no = dict_col_get_clust_pos(
col, clust_index);
ut_a(templ->clust_rec_field_no != ULINT_UNDEFINED);
......
......@@ -554,23 +554,16 @@ row_merge_buf_add(
for (i = 0; i < n_fields; i++, field++, ifield++) {
ulint len;
const dict_col_t* col;
ulint col_no;
ulint fixed_len;
const dfield_t* row_field;
col = ifield->col;
const dict_v_col_t* v_col = NULL;
if (dict_col_is_virtual(col)) {
v_col = reinterpret_cast<const dict_v_col_t*>(col);
}
col_no = dict_col_get_no(col);
const dict_col_t* const col = ifield->col;
const dict_v_col_t* const v_col = col->is_virtual()
? reinterpret_cast<const dict_v_col_t*>(col)
: NULL;
/* Process the Doc ID column */
if (*doc_id > 0
&& col_no == index->table->fts->doc_col
&& !dict_col_is_virtual(col)) {
if (!v_col && *doc_id
&& col->ind == index->table->fts->doc_col) {
fts_write_doc_id((byte*) &write_doc_id, *doc_id);
/* Note: field->data now points to a value on the
......@@ -589,7 +582,7 @@ row_merge_buf_add(
field->type.len = ifield->col->len;
} else {
/* Use callback to get the virtual column value */
if (dict_col_is_virtual(col)) {
if (v_col) {
dict_index_t* clust_index
= dict_table_get_first_index(new_table);
......@@ -614,7 +607,8 @@ row_merge_buf_add(
}
dfield_copy(field, row_field);
} else {
row_field = dtuple_get_nth_field(row, col_no);
row_field = dtuple_get_nth_field(row,
col->ind);
dfield_copy(field, row_field);
}
......@@ -720,7 +714,7 @@ row_merge_buf_add(
} else if (!ext) {
} else if (dict_index_is_clust(index)) {
/* Flag externally stored fields. */
const byte* buf = row_ext_lookup(ext, col_no,
const byte* buf = row_ext_lookup(ext, col->ind,
&len);
if (UNIV_LIKELY_NULL(buf)) {
ut_a(buf != field_ref_zero);
......@@ -731,9 +725,9 @@ row_merge_buf_add(
len = dfield_get_len(field);
}
}
} else if (!dict_col_is_virtual(col)) {
} else if (!v_col) {
/* Only non-virtual column are stored externally */
const byte* buf = row_ext_lookup(ext, col_no,
const byte* buf = row_ext_lookup(ext, col->ind,
&len);
if (UNIV_LIKELY_NULL(buf)) {
ut_a(buf != field_ref_zero);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment