summaryrefslogtreecommitdiff
path: root/storage/innobase/include/row0row.ic
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/include/row0row.ic')
-rw-r--r--storage/innobase/include/row0row.ic162
1 files changed, 50 insertions, 112 deletions
diff --git a/storage/innobase/include/row0row.ic b/storage/innobase/include/row0row.ic
index de417f3d971..05c007641af 100644
--- a/storage/innobase/include/row0row.ic
+++ b/storage/innobase/include/row0row.ic
@@ -1,7 +1,24 @@
-/******************************************************
-General row routines
+/*****************************************************************************
+
+Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; version 2 of the License.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place, Suite 330, Boston, MA 02111-1307 USA
-(c) 1996 Innobase Oy
+*****************************************************************************/
+
+/**************************************************//**
+@file include/row0row.ic
+General row routines
Created 4/20/1996 Heikki Tuuri
*******************************************************/
@@ -10,161 +27,82 @@ Created 4/20/1996 Heikki Tuuri
#include "rem0rec.h"
#include "trx0undo.h"
-/*************************************************************************
-Reads the trx id or roll ptr field from a clustered index record: this function
-is slower than the specialized inline functions. */
-
-dulint
-row_get_rec_sys_field(
-/*==================*/
- /* out: value of the field */
- ulint type, /* in: DATA_TRX_ID or DATA_ROLL_PTR */
- rec_t* rec, /* in: record */
- dict_index_t* index, /* in: clustered index */
- const ulint* offsets);/* in: rec_get_offsets(rec, index) */
-/*************************************************************************
-Sets the trx id or roll ptr field in a clustered index record: this function
-is slower than the specialized inline functions. */
-
-void
-row_set_rec_sys_field(
-/*==================*/
- /* out: value of the field */
- ulint type, /* in: DATA_TRX_ID or DATA_ROLL_PTR */
- rec_t* rec, /* in: record */
- dict_index_t* index, /* in: clustered index */
- const ulint* offsets,/* in: rec_get_offsets(rec, index) */
- dulint val); /* in: value to set */
-
-/*************************************************************************
-Reads the trx id field from a clustered index record. */
+/*********************************************************************//**
+Reads the trx id field from a clustered index record.
+@return value of the field */
UNIV_INLINE
-dulint
+trx_id_t
row_get_rec_trx_id(
/*===============*/
- /* out: value of the field */
- rec_t* rec, /* in: record */
- dict_index_t* index, /* in: clustered index */
- const ulint* offsets)/* in: rec_get_offsets(rec, index) */
+ 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(index->type & DICT_CLUSTERED);
+ ut_ad(dict_index_is_clust(index));
ut_ad(rec_offs_validate(rec, index, offsets));
offset = index->trx_id_offset;
- if (offset) {
- return(trx_read_trx_id(rec + offset));
- } else {
- return(row_get_rec_sys_field(DATA_TRX_ID,
- rec, index, offsets));
+ 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. */
+/*********************************************************************//**
+Reads the roll pointer field from a clustered index record.
+@return value of the field */
UNIV_INLINE
-dulint
+roll_ptr_t
row_get_rec_roll_ptr(
/*=================*/
- /* out: value of the field */
- rec_t* rec, /* in: record */
- dict_index_t* index, /* in: clustered index */
- const ulint* offsets)/* in: rec_get_offsets(rec, index) */
+ 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(index->type & DICT_CLUSTERED);
+ ut_ad(dict_index_is_clust(index));
ut_ad(rec_offs_validate(rec, index, offsets));
offset = index->trx_id_offset;
- if (offset) {
- return(trx_read_roll_ptr(rec + offset + DATA_TRX_ID_LEN));
- } else {
- return(row_get_rec_sys_field(DATA_ROLL_PTR,
- rec, index, offsets));
+ if (!offset) {
+ offset = row_get_trx_id_offset(rec, index, offsets);
}
-}
-/*************************************************************************
-Writes the trx id field to a clustered index record. */
-UNIV_INLINE
-void
-row_set_rec_trx_id(
-/*===============*/
- rec_t* rec, /* in: record */
- dict_index_t* index, /* in: clustered index */
- const ulint* offsets,/* in: rec_get_offsets(rec, index) */
- dulint trx_id) /* in: value of the field */
-{
- ulint offset;
-
- ut_ad(index->type & DICT_CLUSTERED);
- ut_ad(rec_offs_validate(rec, index, offsets));
-
- offset = index->trx_id_offset;
-
- if (offset) {
- trx_write_trx_id(rec + offset, trx_id);
- } else {
- row_set_rec_sys_field(DATA_TRX_ID,
- rec, index, offsets, trx_id);
- }
-}
-
-/*************************************************************************
-Sets the roll pointer field in a clustered index record. */
-UNIV_INLINE
-void
-row_set_rec_roll_ptr(
-/*=================*/
- rec_t* rec, /* in: record */
- dict_index_t* index, /* in: clustered index */
- const ulint* offsets,/* in: rec_get_offsets(rec, index) */
- dulint roll_ptr)/* in: value of the field */
-{
- ulint offset;
-
- ut_ad(index->type & DICT_CLUSTERED);
- ut_ad(rec_offs_validate(rec, index, offsets));
-
- offset = index->trx_id_offset;
-
- if (offset) {
- trx_write_roll_ptr(rec + offset + DATA_TRX_ID_LEN, roll_ptr);
- } else {
- row_set_rec_sys_field(DATA_ROLL_PTR,
- rec, index, offsets, roll_ptr);
- }
+ 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: typed data tuple where the
+ dtuple_t* ref, /*!< in/out: typed data tuple where the
reference is built */
- const ulint* map, /* in: array of field numbers in rec
+ const ulint* map, /*!< in: array of field numbers in rec
telling how ref should be built from
the fields of rec */
- rec_t* rec, /* in: record in the index; must be
+ 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() */
+ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
{
dfield_t* dfield;
- byte* field;
+ 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++) {