mariadb/include/row0row.ic
marko e7267909d7 branches/zip: Initialize dfield_t::ext as soon as possible. This should
fix the bugs introduced in r1591.

row_rec_to_index_entry_low(): Clear "n_ext".  Do not allow it to be NULL.
Add const qualifier to dict_index_t*.

row_rec_to_index_entry(): Add the parameters "offsets" and "n_ext".

btr_cur_optimistic_update(): Add an assertion that there are no externally
stored columns.  Remove the unreachable call to btr_cur_unmark_extern_fields()
and the preceding unnecessary call to rec_get_offsets().

btr_push_update_extern_fields(): Remove the parameters index, offsets.
Only report the additional externally stored columns of the update vector.

row_build(), trx_undo_rec_get_partial_row(): Flag externally stored columns
also with dfield_set_ext().

rec_copy_prefix_to_dtuple(): Assert that there are no externally stored
columns in the prefix.

row_build_row_ref(): Note and assert that the index is a secondary index,
and assert that there are no externally stored columns.

row_build_row_ref_fast(): Assert that there are no externally stored columns.

rec_offs_get_n_alloc(): Expose the function.

row_build_row_ref_in_tuple(): Assert that there are no externally stored
columns in a record of a secondary index.

row_build_row_ref_from_row(): Assert that there are no externally stored
columns.

row_upd_check_references_constraints(): Add the parameter offsets, to
avoid a redundant call to rec_get_offsets().

row_upd_del_mark_clust_rec(): Add the parameter offsets.  Remove
duplicated code.

row_ins_index_entry_set_vals(): Copy the external storage flag.

sel_pop_prefetched_row(): Assert that there are no externally stored
columns.

row_scan_and_check_index(): Copy offsets to a temporary heap across
the invocation of row_rec_to_index_entry().
2007-10-17 12:13:29 +00:00

103 lines
2.6 KiB
Text

/******************************************************
General row routines
(c) 1996 Innobase Oy
Created 4/20/1996 Heikki Tuuri
*******************************************************/
#include "dict0dict.h"
#include "rem0rec.h"
#include "trx0undo.h"
/*************************************************************************
Reads the trx id field from a clustered index record. */
UNIV_INLINE
dulint
row_get_rec_trx_id(
/*===============*/
/* out: value of the field */
const rec_t* rec, /* in: record */
dict_index_t* index, /* in: clustered index */
const ulint* offsets)/* in: rec_get_offsets(rec, index) */
{
ulint offset;
ut_ad(dict_index_is_clust(index));
ut_ad(rec_offs_validate(rec, index, offsets));
offset = index->trx_id_offset;
if (!offset) {
offset = row_get_trx_id_offset(rec, index, offsets);
}
return(trx_read_trx_id(rec + offset));
}
/*************************************************************************
Reads the roll pointer field from a clustered index record. */
UNIV_INLINE
dulint
row_get_rec_roll_ptr(
/*=================*/
/* out: value of the field */
const rec_t* rec, /* in: record */
dict_index_t* index, /* in: clustered index */
const ulint* offsets)/* in: rec_get_offsets(rec, index) */
{
ulint offset;
ut_ad(dict_index_is_clust(index));
ut_ad(rec_offs_validate(rec, index, offsets));
offset = index->trx_id_offset;
if (!offset) {
offset = row_get_trx_id_offset(rec, index, offsets);
}
return(trx_read_roll_ptr(rec + offset + DATA_TRX_ID_LEN));
}
/***********************************************************************
Builds from a secondary index record a row reference with which we can
search the clustered index record. */
UNIV_INLINE
void
row_build_row_ref_fast(
/*===================*/
dtuple_t* ref, /* in/out: typed data tuple where the
reference is built */
const ulint* map, /* in: array of field numbers in rec
telling how ref should be built from
the fields of rec */
const rec_t* rec, /* in: record in the index; must be
preserved while ref is used, as we do
not copy field values to heap */
const ulint* offsets)/* in: array returned by rec_get_offsets() */
{
dfield_t* dfield;
const byte* field;
ulint len;
ulint ref_len;
ulint field_no;
ulint i;
ut_ad(rec_offs_validate(rec, NULL, offsets));
ut_ad(!rec_offs_any_extern(offsets));
ref_len = dtuple_get_n_fields(ref);
for (i = 0; i < ref_len; i++) {
dfield = dtuple_get_nth_field(ref, i);
field_no = *(map + i);
if (field_no != ULINT_UNDEFINED) {
field = rec_get_nth_field(rec, offsets,
field_no, &len);
dfield_set_data(dfield, field, len);
}
}
}