Commit e8a779e7 authored by marko's avatar marko

branches/zip: Remove the casts introduced in r920 and r925. Replace the

accessors returning pointers with macros that preserve const qualifiers.
In UNIV_DEBUG builds, retain the accessors and cast away constness there.

dfield_get_type(), dfield_get_data(), dtuple_get_nth_field(),
dict_table_get_nth_col(), dict_table_get_sys_col(): Implement as macro
unless #ifdef UNIV_DEBUG.

rec_get_nth_field(): Replace with rec_get_nth_field_offs() that does not
do pointer arithmetics.  Implement rec_get_nth_field() as a macro.
parent f52a757e
......@@ -2859,7 +2859,7 @@ btr_index_rec_validate(
ulint fixed_size = dict_col_get_fixed_size(
dict_index_get_nth_col(index, i));
rec_get_nth_field(rec, offsets, i, &len);
rec_get_nth_field_offs(offsets, i, &len);
/* Note that prefix indexes are not fixed size even when
their type is CHAR. */
......
......@@ -3394,8 +3394,7 @@ btr_cur_mark_dtuple_inherited_extern(
}
if (!is_updated) {
dfield = (dfield_t*)
dtuple_get_nth_field(entry, ext_vec[i]);
dfield = dtuple_get_nth_field(entry, ext_vec[i]);
data = (byte*) dfield_get_data(dfield);
len = dfield_get_len(dfield);
......@@ -3460,7 +3459,7 @@ btr_cur_unmark_dtuple_extern_fields(
ulint i;
for (i = 0; i < n_ext_vec; i++) {
dfield = (dfield_t*) dtuple_get_nth_field(entry, ext_vec[i]);
dfield = dtuple_get_nth_field(entry, ext_vec[i]);
data = (byte*) dfield_get_data(dfield);
len = dfield_get_len(dfield);
......
......@@ -321,8 +321,8 @@ btr_search_update_block_hash_info(
#ifdef UNIV_SYNC_DEBUG
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
ut_ad(rw_lock_own(&((buf_block_t*) block)->lock, RW_LOCK_SHARED)
|| rw_lock_own(&((buf_block_t*) block)->lock, RW_LOCK_EX));
ut_ad(rw_lock_own(&block->lock, RW_LOCK_SHARED)
|| rw_lock_own(&block->lock, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(cursor);
......
......@@ -347,7 +347,7 @@ dfield_print(
ulint i;
len = dfield_get_len(dfield);
data = dfield_get_data((dfield_t*) dfield);
data = dfield_get_data(dfield);
if (len == UNIV_SQL_NULL) {
fputs("NULL", stderr);
......@@ -387,7 +387,7 @@ dfield_print_also_hex(
ibool print_also_hex;
len = dfield_get_len(dfield);
data = dfield_get_data((dfield_t*) dfield);
data = dfield_get_data(dfield);
if (len == UNIV_SQL_NULL) {
fputs("NULL", stderr);
......@@ -417,7 +417,7 @@ dfield_print_also_hex(
fputs(" Hex: ", stderr);
data = dfield_get_data((dfield_t*) dfield);
data = dfield_get_data(dfield);
for (i = 0; i < len; i++) {
fprintf(stderr, "%02lx", (ulint)*data);
......@@ -555,7 +555,7 @@ dtuple_convert_big_rec(
i < dtuple_get_n_fields(entry); i++) {
ulint savings;
dfield = (dfield_t*) dtuple_get_nth_field(entry, i);
dfield = dtuple_get_nth_field(entry, i);
ifield = dict_index_get_nth_field(index, i);
/* Skip fixed-length or NULL or short columns */
......@@ -606,7 +606,7 @@ dtuple_convert_big_rec(
we can calculate all ordering fields in all indexes
from locally stored data. */
dfield = (dfield_t*) dtuple_get_nth_field(entry, longest_i);
dfield = dtuple_get_nth_field(entry, longest_i);
ifield = dict_index_get_nth_field(index, longest_i);
vector->fields[n_fields].field_no = longest_i;
......@@ -644,9 +644,8 @@ dtuple_convert_back_big_rec(
for (i = 0; i < vector->n_fields; i++) {
dfield = (dfield_t*)
dtuple_get_nth_field(entry,
vector->fields[i].field_no);
dfield = dtuple_get_nth_field(entry,
vector->fields[i].field_no);
dfield->data = vector->fields[i].data;
dfield->len = vector->fields[i].len;
}
......
......@@ -50,18 +50,18 @@ dict_create_sys_tables_tuple(
entry = dtuple_create(heap, 8 + DATA_N_SYS_COLS);
/* 0: NAME -----------------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 0);
dfield = dtuple_get_nth_field(entry, 0);
dfield_set_data(dfield, table->name, ut_strlen(table->name));
/* 3: ID -------------------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 1);
dfield = dtuple_get_nth_field(entry, 1);
ptr = mem_heap_alloc(heap, 8);
mach_write_to_8(ptr, table->id);
dfield_set_data(dfield, ptr, 8);
/* 4: N_COLS ---------------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 2);
dfield = dtuple_get_nth_field(entry, 2);
#if DICT_TF_COMPACT != 1
#error
......@@ -72,7 +72,7 @@ dict_create_sys_tables_tuple(
| ((table->flags & DICT_TF_COMPACT) << 31));
dfield_set_data(dfield, ptr, 4);
/* 5: TYPE -----------------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 3);
dfield = dtuple_get_nth_field(entry, 3);
ptr = mem_heap_alloc(heap, 4);
if (table->flags & DICT_TF_COMPRESSED_MASK) {
......@@ -86,7 +86,7 @@ dict_create_sys_tables_tuple(
dfield_set_data(dfield, ptr, 4);
/* 6: MIX_ID (obsolete) ---------------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 4);
dfield = dtuple_get_nth_field(entry, 4);
ptr = mem_heap_alloc(heap, 8);
memset(ptr, 0, 8);
......@@ -94,18 +94,18 @@ dict_create_sys_tables_tuple(
dfield_set_data(dfield, ptr, 8);
/* 7: MIX_LEN (obsolete) --------------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 5);
dfield = dtuple_get_nth_field(entry, 5);
ptr = mem_heap_alloc(heap, 4);
memset(ptr, 0, 4);
dfield_set_data(dfield, ptr, 4);
/* 8: CLUSTER_NAME ---------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 6);
dfield = dtuple_get_nth_field(entry, 6);
dfield_set_data(dfield, NULL, UNIV_SQL_NULL); /* not supported */
/* 9: SPACE ----------------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 7);
dfield = dtuple_get_nth_field(entry, 7);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, table->space);
......@@ -147,47 +147,47 @@ dict_create_sys_columns_tuple(
entry = dtuple_create(heap, 7 + DATA_N_SYS_COLS);
/* 0: TABLE_ID -----------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 0);
dfield = dtuple_get_nth_field(entry, 0);
ptr = mem_heap_alloc(heap, 8);
mach_write_to_8(ptr, table->id);
dfield_set_data(dfield, ptr, 8);
/* 1: POS ----------------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 1);
dfield = dtuple_get_nth_field(entry, 1);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, i);
dfield_set_data(dfield, ptr, 4);
/* 4: NAME ---------------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 2);
dfield = dtuple_get_nth_field(entry, 2);
col_name = dict_table_get_col_name(table, i);
dfield_set_data(dfield, col_name, ut_strlen(col_name));
/* 5: MTYPE --------------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 3);
dfield = dtuple_get_nth_field(entry, 3);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, column->mtype);
dfield_set_data(dfield, ptr, 4);
/* 6: PRTYPE -------------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 4);
dfield = dtuple_get_nth_field(entry, 4);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, column->prtype);
dfield_set_data(dfield, ptr, 4);
/* 7: LEN ----------------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 5);
dfield = dtuple_get_nth_field(entry, 5);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, column->len);
dfield_set_data(dfield, ptr, 4);
/* 8: PREC ---------------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 6);
dfield = dtuple_get_nth_field(entry, 6);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, 0/* unused */);
......@@ -338,32 +338,32 @@ dict_create_sys_indexes_tuple(
entry = dtuple_create(heap, 7 + DATA_N_SYS_COLS);
/* 0: TABLE_ID -----------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 0);
dfield = dtuple_get_nth_field(entry, 0);
ptr = mem_heap_alloc(heap, 8);
mach_write_to_8(ptr, table->id);
dfield_set_data(dfield, ptr, 8);
/* 1: ID ----------------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 1);
dfield = dtuple_get_nth_field(entry, 1);
ptr = mem_heap_alloc(heap, 8);
mach_write_to_8(ptr, index->id);
dfield_set_data(dfield, ptr, 8);
/* 4: NAME --------------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 2);
dfield = dtuple_get_nth_field(entry, 2);
dfield_set_data(dfield, index->name, ut_strlen(index->name));
/* 5: N_FIELDS ----------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 3);
dfield = dtuple_get_nth_field(entry, 3);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, index->n_fields);
dfield_set_data(dfield, ptr, 4);
/* 6: TYPE --------------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 4);
dfield = dtuple_get_nth_field(entry, 4);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, index->type);
......@@ -375,7 +375,7 @@ dict_create_sys_indexes_tuple(
#error "DICT_SYS_INDEXES_SPACE_NO_FIELD != 7"
#endif
dfield = (dfield_t*) dtuple_get_nth_field(entry, 5);
dfield = dtuple_get_nth_field(entry, 5);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, index->space);
......@@ -387,7 +387,7 @@ dict_create_sys_indexes_tuple(
#error "DICT_SYS_INDEXES_PAGE_NO_FIELD != 8"
#endif
dfield = (dfield_t*) dtuple_get_nth_field(entry, 6);
dfield = dtuple_get_nth_field(entry, 6);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, FIL_NULL);
......@@ -436,7 +436,7 @@ dict_create_sys_fields_tuple(
entry = dtuple_create(heap, 3 + DATA_N_SYS_COLS);
/* 0: INDEX_ID -----------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 0);
dfield = dtuple_get_nth_field(entry, 0);
ptr = mem_heap_alloc(heap, 8);
mach_write_to_8(ptr, index->id);
......@@ -444,7 +444,7 @@ dict_create_sys_fields_tuple(
dfield_set_data(dfield, ptr, 8);
/* 1: POS + PREFIX LENGTH ----------------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 1);
dfield = dtuple_get_nth_field(entry, 1);
ptr = mem_heap_alloc(heap, 4);
......@@ -464,7 +464,7 @@ dict_create_sys_fields_tuple(
dfield_set_data(dfield, ptr, 4);
/* 4: COL_NAME -------------------------*/
dfield = (dfield_t*) dtuple_get_nth_field(entry, 2);
dfield = dtuple_get_nth_field(entry, 2);
dfield_set_data(dfield, field->name,
ut_strlen(field->name));
......@@ -497,12 +497,12 @@ dict_create_search_tuple(
search_tuple = dtuple_create(heap, 2);
field1 = dtuple_get_nth_field(tuple, 0);
field2 = (dfield_t*) dtuple_get_nth_field(search_tuple, 0);
field2 = dtuple_get_nth_field(search_tuple, 0);
dfield_copy(field2, field1);
field1 = dtuple_get_nth_field(tuple, 1);
field2 = (dfield_t*) dtuple_get_nth_field(search_tuple, 1);
field2 = dtuple_get_nth_field(search_tuple, 1);
dfield_copy(field2, field1);
......
......@@ -1519,8 +1519,7 @@ dict_index_find_cols(
for (j = 0; j < table->n_cols; j++) {
if (!strcmp(dict_table_get_col_name(table, j),
field->name)) {
field->col = (dict_col_t*)
dict_table_get_nth_col(table, j);
field->col = dict_table_get_nth_col(table, j);
goto found;
}
......@@ -1622,8 +1621,7 @@ dict_index_copy_types(
dtype_t* dfield_type;
ifield = dict_index_get_nth_field(index, i);
dfield_type = (dtype_t*)
dfield_get_type(dtuple_get_nth_field(tuple, i));
dfield_type = dfield_get_type(dtuple_get_nth_field(tuple, i));
dict_col_copy_type(dict_field_get_col(ifield), dfield_type);
if (UNIV_UNLIKELY(ifield->prefix_len)) {
dfield_type->len = ifield->prefix_len;
......@@ -1645,8 +1643,7 @@ dict_table_copy_types(
for (i = 0; i < dtuple_get_n_fields(tuple); i++) {
dfield_type = (dtype_t*)
dfield_get_type(dtuple_get_nth_field(tuple, i));
dfield_type = dfield_get_type(dtuple_get_nth_field(tuple, i));
dict_col_copy_type(dict_table_get_nth_col(table, i),
dfield_type);
}
......@@ -1728,18 +1725,18 @@ dict_index_build_internal_clust(
#endif
if (!(index->type & DICT_UNIQUE)) {
dict_index_add_col(new_index, table, (dict_col_t*)
dict_index_add_col(new_index, table,
dict_table_get_sys_col(
table, DATA_ROW_ID),
0);
trx_id_pos++;
}
dict_index_add_col(new_index, table, (dict_col_t*)
dict_index_add_col(new_index, table,
dict_table_get_sys_col(table, DATA_TRX_ID),
0);
dict_index_add_col(new_index, table, (dict_col_t*)
dict_index_add_col(new_index, table,
dict_table_get_sys_col(table,
DATA_ROLL_PTR),
0);
......@@ -3685,11 +3682,10 @@ dict_index_build_node_ptr(
mach_write_to_4(buf, page_no);
field = (dfield_t*) dtuple_get_nth_field(tuple, n_unique);
field = dtuple_get_nth_field(tuple, n_unique);
dfield_set_data(field, buf, 4);
dtype_set((dtype_t*) dfield_get_type(field),
DATA_SYS_CHILD, DATA_NOT_NULL, 4);
dtype_set(dfield_get_type(field), DATA_SYS_CHILD, DATA_NOT_NULL, 4);
rec_copy_prefix_to_dtuple(tuple, rec, index, n_unique, heap);
dtuple_set_info_bits(tuple, dtuple_get_info_bits(tuple)
......
......@@ -80,7 +80,7 @@ dict_get_first_table_name_in_db(
ut_a(!dict_table_is_comp(sys_tables));
tuple = dtuple_create(heap, 1);
dfield = (dfield_t*) dtuple_get_nth_field(tuple, 0);
dfield = dtuple_get_nth_field(tuple, 0);
dfield_set_data(dfield, name, ut_strlen(name));
dict_index_copy_types(tuple, sys_index, 1);
......@@ -408,7 +408,7 @@ dict_load_columns(
ut_a(!dict_table_is_comp(sys_columns));
tuple = dtuple_create(heap, 1);
dfield = (dfield_t*) dtuple_get_nth_field(tuple, 0);
dfield = dtuple_get_nth_field(tuple, 0);
buf = mem_heap_alloc(heap, 8);
mach_write_to_8(buf, table->id);
......@@ -535,7 +535,7 @@ dict_load_fields(
ut_a(!dict_table_is_comp(sys_fields));
tuple = dtuple_create(heap, 1);
dfield = (dfield_t*) dtuple_get_nth_field(tuple, 0);
dfield = dtuple_get_nth_field(tuple, 0);
buf = mem_heap_alloc(heap, 8);
mach_write_to_8(buf, index->id);
......@@ -648,7 +648,7 @@ dict_load_indexes(
ut_a(!dict_table_is_comp(sys_indexes));
tuple = dtuple_create(heap, 1);
dfield = (dfield_t*) dtuple_get_nth_field(tuple, 0);
dfield = dtuple_get_nth_field(tuple, 0);
buf = mem_heap_alloc(heap, 8);
mach_write_to_8(buf, table->id);
......@@ -812,7 +812,7 @@ dict_load_table(
ut_a(!dict_table_is_comp(sys_tables));
tuple = dtuple_create(heap, 1);
dfield = (dfield_t*) dtuple_get_nth_field(tuple, 0);
dfield = dtuple_get_nth_field(tuple, 0);
dfield_set_data(dfield, name, ut_strlen(name));
dict_index_copy_types(tuple, sys_index, 1);
......@@ -991,7 +991,7 @@ dict_load_table_on_id(
heap = mem_heap_create(256);
tuple = dtuple_create(heap, 1);
dfield = (dfield_t*) dtuple_get_nth_field(tuple, 0);
dfield = dtuple_get_nth_field(tuple, 0);
/* Write the table id in byte format to id_buf */
mach_write_to_8(id_buf, table_id);
......@@ -1105,7 +1105,7 @@ dict_load_foreign_cols(
ut_a(!dict_table_is_comp(sys_foreign_cols));
tuple = dtuple_create(foreign->heap, 1);
dfield = (dfield_t*) dtuple_get_nth_field(tuple, 0);
dfield = dtuple_get_nth_field(tuple, 0);
dfield_set_data(dfield, id, ut_strlen(id));
dict_index_copy_types(tuple, sys_index, 1);
......@@ -1179,7 +1179,7 @@ dict_load_foreign(
ut_a(!dict_table_is_comp(sys_foreign));
tuple = dtuple_create(heap2, 1);
dfield = (dfield_t*) dtuple_get_nth_field(tuple, 0);
dfield = dtuple_get_nth_field(tuple, 0);
dfield_set_data(dfield, id, ut_strlen(id));
dict_index_copy_types(tuple, sys_index, 1);
......@@ -1324,7 +1324,7 @@ dict_load_foreigns(
heap = mem_heap_create(256);
tuple = dtuple_create(heap, 1);
dfield = (dfield_t*) dtuple_get_nth_field(tuple, 0);
dfield = dtuple_get_nth_field(tuple, 0);
dfield_set_data(dfield, table_name, ut_strlen(table_name));
dict_index_copy_types(tuple, sec_index, 1);
......
......@@ -202,7 +202,7 @@ dict_mem_table_add_col(
table->n_def - 1,
name, heap);
col = (dict_col_t*) dict_table_get_nth_col(table, table->n_def - 1);
col = dict_table_get_nth_col(table, table->n_def - 1);
col->ind = table->n_def - 1;
col->ord_part = 0;
......
......@@ -1181,7 +1181,7 @@ ibuf_dummy_index_add_col(
dtype_get_mtype(type),
dtype_get_prtype(type),
dtype_get_len(type));
dict_index_add_col(index, index->table, (dict_col_t*)
dict_index_add_col(index, index->table,
dict_table_get_nth_col(index->table, i), len);
}
/************************************************************************
......@@ -1246,14 +1246,14 @@ ibuf_build_entry_from_ibuf_rec(
ut_a(len == n_fields * DATA_ORDER_NULL_TYPE_BUF_SIZE);
for (i = 0; i < n_fields; i++) {
field = (dfield_t*) dtuple_get_nth_field(tuple, i);
field = dtuple_get_nth_field(tuple, i);
data = rec_get_nth_field_old(ibuf_rec, i + 2, &len);
dfield_set_data(field, data, len);
dtype_read_for_order_and_null_size(
(dtype_t*) dfield_get_type(field),
dfield_get_type(field),
types + i * DATA_ORDER_NULL_TYPE_BUF_SIZE);
}
......@@ -1287,14 +1287,14 @@ ibuf_build_entry_from_ibuf_rec(
ut_a(len == n_fields * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE);
for (i = 0; i < n_fields; i++) {
field = (dfield_t*) dtuple_get_nth_field(tuple, i);
field = dtuple_get_nth_field(tuple, i);
data = rec_get_nth_field_old(ibuf_rec, i + 4, &len);
dfield_set_data(field, data, len);
dtype_new_read_for_order_and_null_size(
(dtype_t*) dfield_get_type(field),
dfield_get_type(field),
types + i * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE);
ibuf_dummy_index_add_col(index, dfield_get_type(field), len);
......@@ -1440,7 +1440,7 @@ ibuf_entry_build(
/* Store the space id in tuple */
field = (dfield_t*) dtuple_get_nth_field(tuple, 0);
field = dtuple_get_nth_field(tuple, 0);
buf = mem_heap_alloc(heap, 4);
......@@ -1450,7 +1450,7 @@ ibuf_entry_build(
/* Store the marker byte field in tuple */
field = (dfield_t*) dtuple_get_nth_field(tuple, 1);
field = dtuple_get_nth_field(tuple, 1);
buf = mem_heap_alloc(heap, 1);
......@@ -1462,7 +1462,7 @@ ibuf_entry_build(
/* Store the page number in tuple */
field = (dfield_t*) dtuple_get_nth_field(tuple, 2);
field = dtuple_get_nth_field(tuple, 2);
buf = mem_heap_alloc(heap, 4);
......@@ -1482,7 +1482,7 @@ ibuf_entry_build(
/* We add 4 below because we have the 4 extra fields at the
start of an ibuf record */
field = (dfield_t*) dtuple_get_nth_field(tuple, i + 4);
field = dtuple_get_nth_field(tuple, i + 4);
entry_field = dtuple_get_nth_field(entry, i);
dfield_copy(field, entry_field);
......@@ -1494,7 +1494,7 @@ ibuf_entry_build(
/* Store the type info in buf2 to field 3 of tuple */
field = (dfield_t*) dtuple_get_nth_field(tuple, 3);
field = dtuple_get_nth_field(tuple, 3);
if (dict_table_is_comp(index->table)) {
buf2--;
......@@ -1534,7 +1534,7 @@ ibuf_search_tuple_build(
/* Store the page number in tuple */
field = (dfield_t*) dtuple_get_nth_field(tuple, 0);
field = dtuple_get_nth_field(tuple, 0);
buf = mem_heap_alloc(heap, 4);
......@@ -1569,7 +1569,7 @@ ibuf_new_search_tuple_build(
/* Store the space id in tuple */
field = (dfield_t*) dtuple_get_nth_field(tuple, 0);
field = dtuple_get_nth_field(tuple, 0);
buf = mem_heap_alloc(heap, 4);
......@@ -1579,7 +1579,7 @@ ibuf_new_search_tuple_build(
/* Store the new format record marker byte */
field = (dfield_t*) dtuple_get_nth_field(tuple, 1);
field = dtuple_get_nth_field(tuple, 1);
buf = mem_heap_alloc(heap, 1);
......@@ -1589,7 +1589,7 @@ ibuf_new_search_tuple_build(
/* Store the page number in tuple */
field = (dfield_t*) dtuple_get_nth_field(tuple, 2);
field = dtuple_get_nth_field(tuple, 2);
buf = mem_heap_alloc(heap, 4);
......
......@@ -239,7 +239,7 @@ btr_node_ptr_get_child_page_no(
ut_ad(!rec_offs_comp(offsets) || rec_get_node_ptr_flag(rec));
/* The child address is in the last field */
field = rec_get_nth_field((rec_t*) rec, offsets,
field = rec_get_nth_field(rec, offsets,
rec_offs_n_fields(offsets) - 1, &len);
ut_ad(len == 4);
......
......@@ -38,15 +38,28 @@ dtuple_get_nth_field_noninline(
const dtuple_t* tuple, /* in: tuple */
ulint n); /* in: index of field */
#ifdef UNIV_DEBUG
/*************************************************************************
Gets pointer to the type struct of SQL data field. */
UNIV_INLINE
const dtype_t*
dtype_t*
dfield_get_type(
/*============*/
/* out: pointer to the type struct */
const dfield_t* field); /* in: SQL data field */
/*************************************************************************
Gets pointer to the data in a field. */
UNIV_INLINE
void*
dfield_get_data(
/*============*/
/* out: pointer to data */
const dfield_t* field); /* in: field */
#else /* UNIV_DEBUG */
# define dfield_get_type(field) (&(field)->type)
# define dfield_get_data(field) ((field)->data)
#endif /* UNIV_DEBUG */
/*************************************************************************
Sets the type struct of SQL data field. */
UNIV_INLINE
void
......@@ -55,14 +68,6 @@ dfield_set_type(
dfield_t* field, /* in: SQL data field */
dtype_t* type); /* in: pointer to data type struct */
/*************************************************************************
Gets pointer to the data in a field. */
UNIV_INLINE
void*
dfield_get_data(
/*============*/
/* out: pointer to data */
dfield_t* field); /* in: field */
/*************************************************************************
Gets length of field data. */
UNIV_INLINE
ulint
......@@ -139,15 +144,19 @@ dtuple_get_n_fields(
/*================*/
/* out: number of fields */
const dtuple_t* tuple); /* in: tuple */
#ifdef UNIV_DEBUG
/*************************************************************************
Gets nth field of a tuple. */
UNIV_INLINE
const dfield_t*
dfield_t*
dtuple_get_nth_field(
/*=================*/
/* out: nth field */
const dtuple_t* tuple, /* in: tuple */
ulint n); /* in: index of field */
#else /* UNIV_DEBUG */
# define dtuple_get_nth_field(tuple, n) ((tuple)->fields + (n))
#endif /* UNIV_DEBUG */
/*************************************************************************
Gets info bits in a data tuple. */
UNIV_INLINE
......
......@@ -11,12 +11,11 @@ Created 5/30/1994 Heikki Tuuri
#ifdef UNIV_DEBUG
extern byte data_error;
#endif /* UNIV_DEBUG */
/*************************************************************************
Gets pointer to the type struct of SQL data field. */
UNIV_INLINE
const dtype_t*
dtype_t*
dfield_get_type(
/*============*/
/* out: pointer to the type struct */
......@@ -24,8 +23,9 @@ dfield_get_type(
{
ut_ad(field);
return(&(field->type));
return((dtype_t*) &(field->type));
}
#endif /* UNIV_DEBUG */
/*************************************************************************
Sets the type struct of SQL data field. */
......@@ -41,6 +41,7 @@ dfield_set_type(
field->type = *type;
}
#ifdef UNIV_DEBUG
/*************************************************************************
Gets pointer to the data in a field. */
UNIV_INLINE
......@@ -48,14 +49,15 @@ void*
dfield_get_data(
/*============*/
/* out: pointer to data */
dfield_t* field) /* in: field */
const dfield_t* field) /* in: field */
{
ut_ad(field);
ut_ad((field->len == UNIV_SQL_NULL)
|| (field->data != &data_error));
return(field->data);
return((void*) field->data);
}
#endif /* UNIV_DEBUG */
/*************************************************************************
Gets length of field data. */
......@@ -229,10 +231,11 @@ dtuple_get_n_fields(
return(tuple->n_fields);
}
#ifdef UNIV_DEBUG
/*************************************************************************
Gets nth field of a tuple. */
UNIV_INLINE
const dfield_t*
dfield_t*
dtuple_get_nth_field(
/*=================*/
/* out: nth field */
......@@ -242,8 +245,9 @@ dtuple_get_nth_field(
ut_ad(tuple);
ut_ad(n < tuple->n_fields);
return(tuple->fields + n);
return((dfield_t*) tuple->fields + n);
}
#endif /* UNIV_DEBUG */
/**************************************************************
Creates a data tuple to a memory heap. The default value for number
......@@ -276,7 +280,7 @@ dtuple_create(
for (i = 0; i < n_fields; i++) {
(tuple->fields + i)->data = &data_error;
(tuple->fields + i)->type.mtype = DATA_ERROR;
dfield_get_type(tuple->fields + i)->mtype = DATA_ERROR;
}
}
#endif
......@@ -333,8 +337,7 @@ dtuple_set_types_binary(
ulint i;
for (i = 0; i < n; i++) {
dfield_type = (dtype_t*)
dfield_get_type(dtuple_get_nth_field(tuple, i));
dfield_type = dfield_get_type(dtuple_get_nth_field(tuple, i));
dtype_set(dfield_type, DATA_BINARY, 0, 0);
}
}
......@@ -367,7 +370,7 @@ dtuple_fold(
for (i = 0; i < n_fields; i++) {
field = dtuple_get_nth_field(tuple, i);
data = (const byte*) dfield_get_data((dfield_t*) field);
data = (const byte*) dfield_get_data(field);
len = dfield_get_len(field);
if (len != UNIV_SQL_NULL) {
......@@ -379,7 +382,7 @@ dtuple_fold(
if (n_bytes > 0) {
field = dtuple_get_nth_field(tuple, i);
data = (const byte*) dfield_get_data((dfield_t*) field);
data = (const byte*) dfield_get_data(field);
len = dfield_get_len(field);
if (len != UNIV_SQL_NULL) {
......
......@@ -549,16 +549,32 @@ dict_table_get_n_cols(
/*==================*/
/* out: number of columns of a table */
dict_table_t* table); /* in: table */
#ifdef UNIV_DEBUG
/************************************************************************
Gets the nth column of a table. */
UNIV_INLINE
const dict_col_t*
dict_col_t*
dict_table_get_nth_col(
/*===================*/
/* out: pointer to column object */
const dict_table_t* table, /* in: table */
ulint pos); /* in: position of column */
/************************************************************************
Gets the given system column of a table. */
UNIV_INLINE
dict_col_t*
dict_table_get_sys_col(
/*===================*/
/* out: pointer to column object */
const dict_table_t* table, /* in: table */
ulint sys); /* in: DATA_ROW_ID, ... */
#else /* UNIV_DEBUG */
#define dict_table_get_nth_col(table, pos) \
((table)->cols + (pos))
#define dict_table_get_sys_col(table, sys) \
((table)->cols + (table)->n_cols + (sys) - DATA_N_SYS_COLS)
#endif /* UNIV_DEBUG */
/************************************************************************
Gets the nth column of a table. */
const dict_col_t*
......@@ -568,23 +584,14 @@ dict_table_get_nth_col_noninline(
const dict_table_t* table, /* in: table */
ulint pos); /* in: position of column */
/************************************************************************
Gets the given system column of a table. */
UNIV_INLINE
const dict_col_t*
dict_table_get_sys_col(
/*===================*/
/* out: pointer to column object */
const dict_table_t* table, /* in: table */
ulint sys); /* in: DATA_ROW_ID, ... */
/************************************************************************
Gets the given system column number of a table. */
UNIV_INLINE
ulint
dict_table_get_sys_col_no(
/*======================*/
/* out: column number */
dict_table_t* table, /* in: table */
ulint sys); /* in: DATA_ROW_ID, ... */
/* out: column number */
const dict_table_t* table, /* in: table */
ulint sys); /* in: DATA_ROW_ID, ... */
/************************************************************************
Check whether the table uses the compact page format. */
UNIV_INLINE
......
......@@ -213,10 +213,11 @@ dict_table_get_n_cols(
return(table->n_cols);
}
#ifdef UNIV_DEBUG
/************************************************************************
Gets the nth column of a table. */
UNIV_INLINE
const dict_col_t*
dict_col_t*
dict_table_get_nth_col(
/*===================*/
/* out: pointer to column object */
......@@ -227,20 +228,20 @@ dict_table_get_nth_col(
ut_ad(pos < table->n_def);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
return((table->cols) + pos);
return((dict_col_t*) (table->cols) + pos);
}
/************************************************************************
Gets the given system column of a table. */
UNIV_INLINE
const dict_col_t*
dict_col_t*
dict_table_get_sys_col(
/*===================*/
/* out: pointer to column object */
const dict_table_t* table, /* in: table */
ulint sys) /* in: DATA_ROW_ID, ... */
{
const dict_col_t* col;
dict_col_t* col;
ut_ad(table);
ut_ad(sys < DATA_N_SYS_COLS);
......@@ -253,6 +254,7 @@ dict_table_get_sys_col(
return(col);
}
#endif /* UNIV_DEBUG */
/************************************************************************
Gets the given system column number of a table. */
......@@ -260,9 +262,9 @@ UNIV_INLINE
ulint
dict_table_get_sys_col_no(
/*======================*/
/* out: column number */
dict_table_t* table, /* in: table */
ulint sys) /* in: DATA_ROW_ID, ... */
/* out: column number */
const dict_table_t* table, /* in: table */
ulint sys) /* in: DATA_ROW_ID, ... */
{
ut_ad(table);
ut_ad(sys < DATA_N_SYS_COLS);
......
......@@ -46,9 +46,9 @@ cmp_dfield_dfield(
type = dfield_get_type(dfield1);
return(cmp_data_data(type->mtype, type->prtype,
dfield_get_data((dfield_t*) dfield1),
dfield_get_data(dfield1),
dfield_get_len(dfield1),
dfield_get_data((dfield_t*) dfield2),
dfield_get_data(dfield2),
dfield_get_len(dfield2)));
}
......
......@@ -395,18 +395,19 @@ rec_get_nth_field_size(
const rec_t* rec, /* in: record */
ulint n); /* in: index of the field */
/****************************************************************
The following function is used to get a pointer to the nth
The following function is used to get an offset to the nth
data field in a record. */
UNIV_INLINE
byte*
rec_get_nth_field(
/*==============*/
/* out: pointer to the field */
rec_t* rec, /* in: record */
ulint
rec_get_nth_field_offs(
/*===================*/
/* out: offset from the origin of rec */
const ulint* offsets,/* in: array returned by rec_get_offsets() */
ulint n, /* in: index of the field */
ulint* len); /* out: length of the field; UNIV_SQL_NULL
if SQL null */
#define rec_get_nth_field(rec, offsets, n, len) \
(rec + rec_get_nth_field_offs(offsets, n, len))
/**********************************************************
Determine if the offsets are for a record in the new
compact format. */
......
......@@ -994,30 +994,27 @@ rec_offs_make_valid(
}
/****************************************************************
The following function is used to get a pointer to the nth
The following function is used to get an offset to the nth
data field in a record. */
UNIV_INLINE
byte*
rec_get_nth_field(
/*==============*/
/* out: pointer to the field */
rec_t* rec, /* in: record */
ulint
rec_get_nth_field_offs(
/*===================*/
/* out: offset from the origin of rec */
const ulint* offsets,/* in: array returned by rec_get_offsets() */
ulint n, /* in: index of the field */
ulint* len) /* out: length of the field; UNIV_SQL_NULL
if SQL null */
{
byte* field;
ulint offs;
ulint length;
ut_ad(rec);
ut_ad(rec_offs_validate(rec, NULL, offsets));
ut_ad(n < rec_offs_n_fields(offsets));
ut_ad(len);
if (UNIV_UNLIKELY(n == 0)) {
field = rec;
offs = 0;
} else {
field = rec + (rec_offs_base(offsets)[n] & REC_OFFS_MASK);
offs = rec_offs_base(offsets)[n] & REC_OFFS_MASK;
}
length = rec_offs_base(offsets)[1 + n];
......@@ -1026,11 +1023,11 @@ rec_get_nth_field(
length = UNIV_SQL_NULL;
} else {
length &= REC_OFFS_MASK;
length -= field - rec;
length -= offs;
}
*len = length;
return(field);
return(offs);
}
/**********************************************************
......@@ -1602,7 +1599,7 @@ rec_fold(
fold = ut_fold_dulint(tree_id);
for (i = 0; i < n_fields; i++) {
data = rec_get_nth_field((rec_t*) rec, offsets, i, &len);
data = rec_get_nth_field(rec, offsets, i, &len);
if (len != UNIV_SQL_NULL) {
fold = ut_fold_ulint_pair(fold,
......@@ -1611,7 +1608,7 @@ rec_fold(
}
if (n_bytes > 0) {
data = rec_get_nth_field((rec_t*) rec, offsets, i, &len);
data = rec_get_nth_field(rec, offsets, i, &len);
if (len != UNIV_SQL_NULL) {
if (len > n_bytes) {
......
......@@ -88,7 +88,7 @@ row_build_row_ref_fast(
ref_len = dtuple_get_n_fields(ref);
for (i = 0; i < ref_len; i++) {
dfield = (dfield_t*) dtuple_get_nth_field(ref, i);
dfield = dtuple_get_nth_field(ref, i);
field_no = *(map + i);
......
......@@ -596,7 +596,7 @@ mlog_parse_index(
len & 0x8000 ? DATA_NOT_NULL : 0,
len & 0x7fff);
dict_index_add_col(ind, table, (dict_col_t*)
dict_index_add_col(ind, table,
dict_table_get_nth_col(table, i),
0);
}
......
......@@ -350,10 +350,10 @@ page_create_low(
/* Create first a data tuple for infimum record */
tuple = dtuple_create(heap, 1);
dtuple_set_info_bits(tuple, REC_STATUS_INFIMUM);
field = (dfield_t*) dtuple_get_nth_field(tuple, 0);
field = dtuple_get_nth_field(tuple, 0);
dfield_set_data(field, "infimum", 8);
dtype_set((dtype_t*) dfield_get_type(field),
dtype_set(dfield_get_type(field),
DATA_VARCHAR, DATA_ENGLISH | DATA_NOT_NULL, 8);
/* Set the corresponding physical record to its place in the page
record heap */
......@@ -384,10 +384,10 @@ page_create_low(
tuple = dtuple_create(heap, 1);
dtuple_set_info_bits(tuple, REC_STATUS_SUPREMUM);
field = (dfield_t*) dtuple_get_nth_field(tuple, 0);
field = dtuple_get_nth_field(tuple, 0);
dfield_set_data(field, "supremum", comp ? 8 : 9);
dtype_set((dtype_t*) dfield_get_type(field),
dtype_set(dfield_get_type(field),
DATA_VARCHAR, DATA_ENGLISH | DATA_NOT_NULL, comp ? 8 : 9);
supremum_rec = rec_convert_dtuple_to_rec(heap_top, index,
......
......@@ -1247,7 +1247,7 @@ page_zip_fields_decode(
dict_mem_table_add_col(table, "DUMMY", mtype,
val & 1 ? DATA_NOT_NULL : 0, len);
dict_index_add_col(index, table, (dict_col_t*)
dict_index_add_col(index, table,
dict_table_get_nth_col(table, i), 0);
}
......@@ -2607,13 +2607,12 @@ page_zip_write_rec(
ut_ad(!rec_offs_nth_extern(offsets,
i + 1));
/* Locate trx_id and roll_ptr. */
src = rec_get_nth_field((rec_t*) rec,
offsets,
src = rec_get_nth_field(rec, offsets,
i, &len);
ut_ad(len == DATA_TRX_ID_LEN);
ut_ad(src + DATA_TRX_ID_LEN
== rec_get_nth_field(
(rec_t*) rec, offsets,
rec, offsets,
i + 1, &len));
ut_ad(len == DATA_ROLL_PTR_LEN);
......@@ -2634,8 +2633,7 @@ page_zip_write_rec(
+ DATA_ROLL_PTR_LEN);
i++; /* skip also roll_ptr */
} else if (rec_offs_nth_extern(offsets, i)) {
src = rec_get_nth_field((rec_t*) rec,
offsets,
src = rec_get_nth_field(rec, offsets,
i, &len);
ut_ad(dict_index_is_clust(index));
......@@ -2779,11 +2777,11 @@ page_zip_write_blob_ptr(
mtr_t* mtr) /* in: mini-transaction handle,
or NULL if no logging is needed */
{
byte* field;
byte* externs;
page_t* page = page_align((byte*) rec);
ulint blob_no;
ulint len;
const byte* field;
byte* externs;
page_t* page = page_align((byte*) rec);
ulint blob_no;
ulint len;
ut_ad(buf_frame_get_page_zip((byte*) rec) == page_zip);
ut_ad(page_simple_validate_new(page));
......@@ -2809,7 +2807,7 @@ page_zip_write_blob_ptr(
* (PAGE_ZIP_DIR_SLOT_SIZE
+ DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN);
field = rec_get_nth_field((rec_t*) rec, offsets, n, &len);
field = rec_get_nth_field(rec, offsets, n, &len);
externs -= (blob_no + 1) * BTR_EXTERN_FIELD_REF_SIZE;
field += len - BTR_EXTERN_FIELD_REF_SIZE;
......
......@@ -505,7 +505,7 @@ pars_resolve_exp_columns(
sym_node->prefetch_buf = NULL;
dict_col_copy_type(
col, (dtype_t*)
col,
dfield_get_type(&sym_node
->common.val));
......@@ -1132,24 +1132,23 @@ pars_set_dfield_type(
if (type == &pars_int_token) {
ut_a(len == 0);
dtype_set((dtype_t*) dfield_get_type(dfield),
DATA_INT, flags, 4);
dtype_set(dfield_get_type(dfield), DATA_INT, flags, 4);
} else if (type == &pars_char_token) {
ut_a(len == 0);
dtype_set((dtype_t*) dfield_get_type(dfield),
DATA_VARCHAR, DATA_ENGLISH | flags, 0);
dtype_set(dfield_get_type(dfield), DATA_VARCHAR,
DATA_ENGLISH | flags, 0);
} else if (type == &pars_binary_token) {
ut_a(len != 0);
dtype_set((dtype_t*) dfield_get_type(dfield),
DATA_FIXBINARY, DATA_BINARY_TYPE | flags, len);
dtype_set(dfield_get_type(dfield), DATA_FIXBINARY,
DATA_BINARY_TYPE | flags, len);
} else if (type == &pars_blob_token) {
ut_a(len == 0);
dtype_set((dtype_t*) dfield_get_type(dfield),
DATA_BLOB, DATA_BINARY_TYPE | flags, 0);
dtype_set(dfield_get_type(dfield), DATA_BLOB,
DATA_BINARY_TYPE | flags, 0);
} else {
ut_error;
}
......
......@@ -487,7 +487,7 @@ cmp_dtuple_rec_with_match(
dtuple_f_len = dfield_get_len(dtuple_field);
rec_b_ptr = rec_get_nth_field((rec_t*) rec, offsets,
rec_b_ptr = rec_get_nth_field(rec, offsets,
cur_field, &rec_f_len);
/* If we have matched yet 0 bytes, it may be that one or
......@@ -530,7 +530,7 @@ cmp_dtuple_rec_with_match(
!= DATA_MYSQL_LATIN1_SWEDISH_CHARSET_COLL)) {
ret = cmp_whole_field(mtype, prtype,
dtuple_field->data,
dfield_get_data(dtuple_field),
(unsigned) dtuple_f_len,
rec_b_ptr, (unsigned) rec_f_len);
......@@ -546,7 +546,8 @@ cmp_dtuple_rec_with_match(
/* Set the pointers at the current byte */
rec_b_ptr = rec_b_ptr + cur_bytes;
dtuple_b_ptr = (byte*) dtuple_field->data + cur_bytes;
dtuple_b_ptr = (byte*)dfield_get_data(dtuple_field)
+ cur_bytes;
/* Compare then the fields */
for (;;) {
......@@ -778,9 +779,9 @@ cmp_rec_rec_with_match(
prtype = col->prtype;
}
rec1_b_ptr = rec_get_nth_field((rec_t*) rec1, offsets1,
rec1_b_ptr = rec_get_nth_field(rec1, offsets1,
cur_field, &rec1_f_len);
rec2_b_ptr = rec_get_nth_field((rec_t*) rec2, offsets2,
rec2_b_ptr = rec_get_nth_field(rec2, offsets2,
cur_field, &rec2_f_len);
if (cur_bytes == 0) {
......@@ -1030,10 +1031,10 @@ cmp_debug_dtuple_rec_with_match(
prtype = type->prtype;
}
dtuple_f_data = dtuple_field->data;
dtuple_f_data = dfield_get_data(dtuple_field);
dtuple_f_len = dfield_get_len(dtuple_field);
rec_f_data = rec_get_nth_field((rec_t*) rec, offsets,
rec_f_data = rec_get_nth_field(rec, offsets,
cur_field, &rec_f_len);
if (rec_offs_nth_extern(offsets, cur_field)) {
......
......@@ -812,7 +812,7 @@ rec_convert_dtuple_to_rec_old(
field = dtuple_get_nth_field(dtuple, i);
data = dfield_get_data((dfield_t*) field);
data = dfield_get_data(field);
len = dfield_get_len(field);
if (len == UNIV_SQL_NULL) {
......@@ -842,7 +842,7 @@ rec_convert_dtuple_to_rec_old(
field = dtuple_get_nth_field(dtuple, i);
data = dfield_get_data((dfield_t*) field);
data = dfield_get_data(field);
len = dfield_get_len(field);
if (len == UNIV_SQL_NULL) {
......@@ -997,7 +997,7 @@ rec_convert_dtuple_to_rec_new(
if (UNIV_UNLIKELY(i == n_node_ptr_field)) {
ut_ad(dtype_get_prtype(type) & DATA_NOT_NULL);
ut_ad(len == 4);
memcpy(end, dfield_get_data((dfield_t*) field), len);
memcpy(end, dfield_get_data(field), len);
end += 4;
break;
}
......@@ -1047,7 +1047,7 @@ rec_convert_dtuple_to_rec_new(
}
}
memcpy(end, dfield_get_data((dfield_t*) field), len);
memcpy(end, dfield_get_data(field), len);
end += len;
}
......@@ -1136,8 +1136,8 @@ rec_copy_prefix_to_dtuple(
for (i = 0; i < n_fields; i++) {
field = (dfield_t*) dtuple_get_nth_field(tuple, i);
data = rec_get_nth_field((rec_t*) rec, offsets, i, &len);
field = dtuple_get_nth_field(tuple, i);
data = rec_get_nth_field(rec, offsets, i, &len);
if (len != UNIV_SQL_NULL) {
buf = mem_heap_alloc(heap, len);
......@@ -1397,7 +1397,7 @@ rec_validate(
ut_a(rec_offs_comp(offsets) || n_fields <= rec_get_n_fields_old(rec));
for (i = 0; i < n_fields; i++) {
data = rec_get_nth_field((rec_t*) rec, offsets, i, &len);
data = rec_get_nth_field(rec, offsets, i, &len);
if (!((len < UNIV_PAGE_SIZE) || (len == UNIV_SQL_NULL))) {
fprintf(stderr,
......@@ -1516,7 +1516,7 @@ rec_print_new(
for (i = 0; i < rec_offs_n_fields(offsets); i++) {
data = rec_get_nth_field((rec_t*) rec, offsets, i, &len);
data = rec_get_nth_field(rec, offsets, i, &len);
fprintf(file, " %lu:", (ulong) i);
......
......@@ -153,7 +153,7 @@ row_ins_alloc_sys_fields(
col = dict_table_get_sys_col(table, DATA_ROW_ID);
dfield = (dfield_t*) dtuple_get_nth_field(row, dict_col_get_no(col));
dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
ptr = mem_heap_alloc(heap, DATA_ROW_ID_LEN);
......@@ -165,7 +165,7 @@ row_ins_alloc_sys_fields(
col = dict_table_get_sys_col(table, DATA_TRX_ID);
dfield = (dfield_t*) dtuple_get_nth_field(row, dict_col_get_no(col));
dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
ptr = mem_heap_alloc(heap, DATA_TRX_ID_LEN);
dfield_set_data(dfield, ptr, DATA_TRX_ID_LEN);
......@@ -176,7 +176,7 @@ row_ins_alloc_sys_fields(
col = dict_table_get_sys_col(table, DATA_ROLL_PTR);
dfield = (dfield_t*) dtuple_get_nth_field(row, dict_col_get_no(col));
dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
ptr = mem_heap_alloc(heap, DATA_ROLL_PTR_LEN);
dfield_set_data(dfield, ptr, DATA_ROLL_PTR_LEN);
......@@ -2214,7 +2214,7 @@ row_ins_index_entry_set_vals(
n_fields = dtuple_get_n_fields(entry);
for (i = 0; i < n_fields; i++) {
field = (dfield_t*) dtuple_get_nth_field(entry, i);
field = dtuple_get_nth_field(entry, i);
ind_field = dict_index_get_nth_field(index, i);
row_field = dtuple_get_nth_field(row, ind_field->col->ind);
......@@ -2313,7 +2313,7 @@ row_ins_get_row_from_values(
while (list_node) {
eval_exp(list_node);
dfield = (dfield_t*) dtuple_get_nth_field(row, i);
dfield = dtuple_get_nth_field(row, i);
dfield_copy_data(dfield, que_node_get_val(list_node));
i++;
......@@ -2344,7 +2344,7 @@ row_ins_get_row_from_select(
list_node = node->select->select_list;
while (list_node) {
dfield = (dfield_t*) dtuple_get_nth_field(row, i);
dfield = dtuple_get_nth_field(row, i);
dfield_copy_data(dfield, que_node_get_val(list_node));
i++;
......
......@@ -401,7 +401,7 @@ row_mysql_convert_row_to_innobase(
for (i = 0; i < prebuilt->n_template; i++) {
templ = prebuilt->mysql_template + i;
dfield = (dfield_t*) dtuple_get_nth_field(row, i);
dfield = dtuple_get_nth_field(row, i);
if (templ->mysql_null_bit_mask != 0) {
/* Column may be SQL NULL */
......@@ -825,9 +825,7 @@ row_get_prebuilt_insert_row(
for (i = 0; i < dtuple_get_n_fields(row); i++) {
dfield_set_len((dfield_t*)
dtuple_get_nth_field(row, i),
UNIV_SQL_NULL);
dtuple_get_nth_field(row, i)->len = UNIV_SQL_NULL;
}
ins_node_set_new_row(node, row);
......@@ -2785,7 +2783,7 @@ row_truncate_table_for_mysql(
heap = mem_heap_create(800);
tuple = dtuple_create(heap, 1);
dfield = (dfield_t*) dtuple_get_nth_field(tuple, 0);
dfield = dtuple_get_nth_field(tuple, 0);
buf = mem_heap_alloc(heap, 8);
mach_write_to_8(buf, table->id);
......
......@@ -106,7 +106,7 @@ row_build_index_entry(
col = ind_field->col;
col_no = dict_col_get_no(col);
dfield = (dfield_t*) dtuple_get_nth_field(entry, i);
dfield = dtuple_get_nth_field(entry, i);
dfield2 = dtuple_get_nth_field(row, col_no);
......@@ -137,8 +137,7 @@ row_build_index_entry(
dfield_set_len(dfield, storage_len);
}
((dtype_t*) dfield_get_type(dfield))->len
= ind_field->prefix_len;
dfield_get_type(dfield)->len = ind_field->prefix_len;
}
}
......@@ -232,11 +231,10 @@ row_build(
if (ind_field->prefix_len == 0) {
dfield_t* dfield
= (dfield_t*) dtuple_get_nth_field(
row, dict_col_get_no(col));
byte* field
= rec_get_nth_field(rec, offsets, i, &len);
dfield_t* dfield = dtuple_get_nth_field(
row, dict_col_get_no(col));
byte* field = rec_get_nth_field(
rec, offsets, i, &len);
dfield_set_data(dfield, field, len);
}
......@@ -328,7 +326,7 @@ row_rec_to_index_entry(
for (i = 0; i < rec_len; i++) {
dfield = (dfield_t*) dtuple_get_nth_field(entry, i);
dfield = dtuple_get_nth_field(entry, i);
field = rec_get_nth_field(rec, offsets, i, &len);
dfield_set_data(dfield, field, len);
......@@ -408,7 +406,7 @@ row_build_row_ref(
dict_index_copy_types(ref, clust_index, ref_len);
for (i = 0; i < ref_len; i++) {
dfield = (dfield_t*) dtuple_get_nth_field(ref, i);
dfield = dtuple_get_nth_field(ref, i);
pos = dict_index_get_nth_field_pos(index, clust_index, i);
......@@ -510,7 +508,7 @@ row_build_row_ref_in_tuple(
dict_index_copy_types(ref, clust_index, ref_len);
for (i = 0; i < ref_len; i++) {
dfield = (dfield_t*) dtuple_get_nth_field(ref, i);
dfield = dtuple_get_nth_field(ref, i);
pos = dict_index_get_nth_field_pos(index, clust_index, i);
......@@ -584,7 +582,7 @@ row_build_row_ref_from_row(
dfield_t* dfield;
const dfield_t* dfield2;
dfield = (dfield_t*) dtuple_get_nth_field(ref, i);
dfield = dtuple_get_nth_field(ref, i);
field = dict_index_get_nth_field(clust_index, i);
......
......@@ -966,8 +966,7 @@ row_sel_open_pcur(
for (i = 0; i < n_fields; i++) {
exp = plan->tuple_exps[i];
dfield_copy_data((dfield_t*)
dtuple_get_nth_field(plan->tuple, i),
dfield_copy_data(dtuple_get_nth_field(plan->tuple, i),
que_node_get_val(exp));
}
......@@ -2271,7 +2270,7 @@ row_sel_convert_mysql_key_to_innobase(
dtuple_set_n_fields(tuple, ULINT_MAX);
dfield = (dfield_t*) dtuple_get_nth_field(tuple, 0);
dfield = dtuple_get_nth_field(tuple, 0);
field = dict_index_get_nth_field(index, 0);
if (UNIV_UNLIKELY(dfield_get_type(dfield)->mtype == DATA_SYS)) {
......
......@@ -352,7 +352,7 @@ row_upd_index_entry_sys_field(
pos = dict_index_get_sys_col_pos(index, type);
dfield = (dfield_t*) dtuple_get_nth_field(entry, pos);
dfield = dtuple_get_nth_field(entry, pos);
field = dfield_get_data(dfield);
if (type == DATA_TRX_ID) {
......@@ -758,7 +758,7 @@ row_upd_build_sec_rec_difference_binary(
for (i = 0; i < dtuple_get_n_fields(entry); i++) {
data = rec_get_nth_field((rec_t*) rec, offsets, i, &len);
data = rec_get_nth_field(rec, offsets, i, &len);
dfield = dtuple_get_nth_field(entry, i);
......@@ -840,7 +840,7 @@ row_upd_build_difference_binary(
for (i = 0; i < dtuple_get_n_fields(entry); i++) {
data = rec_get_nth_field((rec_t*) rec, offsets, i, &len);
data = rec_get_nth_field(rec, offsets, i, &len);
dfield = dtuple_get_nth_field(entry, i);
......@@ -926,8 +926,7 @@ row_upd_index_replace_new_col_vals_index_pos(
if (upd_field->field_no == j) {
dfield = (dfield_t*)
dtuple_get_nth_field(entry, j);
dfield = dtuple_get_nth_field(entry, j);
new_val = &(upd_field->new_val);
......@@ -1003,8 +1002,7 @@ row_upd_index_replace_new_col_vals(
if (upd_field->field_no == clust_pos) {
dfield = (dfield_t*)
dtuple_get_nth_field(entry, j);
dfield = dtuple_get_nth_field(entry, j);
new_val = &(upd_field->new_val);
......
......@@ -903,7 +903,7 @@ srv_init(void)
srv_sys->dummy_ind1 = dict_mem_index_create(
"SYS_DUMMY1", "SYS_DUMMY1", DICT_HDR_SPACE, 0, 1);
dict_index_add_col(srv_sys->dummy_ind1, table, (dict_col_t*)
dict_index_add_col(srv_sys->dummy_ind1, table,
dict_table_get_nth_col(table, 0), 0);
srv_sys->dummy_ind1->table = table;
/* create dummy table and index for new-style infimum and supremum */
......@@ -913,7 +913,7 @@ srv_init(void)
DATA_ENGLISH | DATA_NOT_NULL, 8);
srv_sys->dummy_ind2 = dict_mem_index_create(
"SYS_DUMMY2", "SYS_DUMMY2", DICT_HDR_SPACE, 0, 1);
dict_index_add_col(srv_sys->dummy_ind2, table, (dict_col_t*)
dict_index_add_col(srv_sys->dummy_ind2, table,
dict_table_get_nth_col(table, 0), 0);
srv_sys->dummy_ind2->table = table;
......
......@@ -205,7 +205,7 @@ trx_undo_page_report_insert(
return(0);
}
memcpy(ptr, field->data, flen);
ut_memcpy(ptr, dfield_get_data(field), flen);
ptr += flen;
}
}
......@@ -349,7 +349,7 @@ trx_undo_rec_get_row_ref(
dict_index_copy_types(*ref, index, ref_len);
for (i = 0; i < ref_len; i++) {
dfield = (dfield_t*) dtuple_get_nth_field(*ref, i);
dfield = dtuple_get_nth_field(*ref, i);
ptr = trx_undo_rec_get_col_val(ptr, &field, &len);
......@@ -936,7 +936,7 @@ trx_undo_rec_get_partial_row(
ext_cols[n_ext_cols++] = col_no;
}
dfield = (dfield_t*) dtuple_get_nth_field(*row, col_no);
dfield = dtuple_get_nth_field(*row, col_no);
dfield_set_data(dfield, field, len);
}
......
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