1
/*****************************************************************************
3
Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved.
5
This program is free software; you can redistribute it and/or modify it under
6
the terms of the GNU General Public License as published by the Free Software
7
Foundation; version 2 of the License.
9
This program is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
You should have received a copy of the GNU General Public License along with
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
St, Fifth Floor, Boston, MA 02110-1301 USA
17
*****************************************************************************/
19
/**************************************************//**
20
@file include/row0ext.ic
21
Caching of externally stored column prefixes
23
Created September 2006 Marko Makela
24
*******************************************************/
26
#include "rem0types.h"
27
#include "btr0types.h"
29
/********************************************************************//**
30
Looks up a column prefix of an externally stored column.
31
@return column prefix, or NULL if the column is not stored externally,
32
or pointer to field_ref_zero if the BLOB pointer is unset */
37
const row_ext_t* ext, /*!< in/out: column prefix cache */
38
ulint i, /*!< in: index of ext->ext[] */
39
ulint* len) /*!< out: length of prefix, in bytes,
40
at most REC_MAX_INDEX_COL_LEN */
44
ut_ad(i < ext->n_ext);
48
if (UNIV_UNLIKELY(*len == 0)) {
49
/* The BLOB could not be fetched to the cache. */
50
return(field_ref_zero);
52
return(ext->buf + i * REC_MAX_INDEX_COL_LEN);
56
/********************************************************************//**
57
Looks up a column prefix of an externally stored column.
58
@return column prefix, or NULL if the column is not stored externally,
59
or pointer to field_ref_zero if the BLOB pointer is unset */
64
const row_ext_t* ext, /*!< in: column prefix cache */
65
ulint col, /*!< in: column number in the InnoDB
66
table object, as reported by
67
dict_col_get_no(); NOT relative to the
68
records in the clustered index */
69
ulint* len) /*!< out: length of prefix, in bytes,
70
at most REC_MAX_INDEX_COL_LEN */
77
for (i = 0; i < ext->n_ext; i++) {
78
if (col == ext->ext[i]) {
79
return(row_ext_lookup_ith(ext, i, len));