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., 59 Temple
15
Place, Suite 330, Boston, MA 02111-1307 USA
17
*****************************************************************************/
19
/******************************************************
20
Caching of externally stored column prefixes
22
Created September 2006 Marko Makela
23
*******************************************************/
25
#include "rem0types.h"
26
#include "btr0types.h"
28
/************************************************************************
29
Looks up a column prefix of an externally stored column. */
34
/* out: column prefix, or NULL if
35
the column is not stored externally,
36
or pointer to field_ref_zero
37
if the BLOB pointer is unset */
38
const row_ext_t* ext, /* in/out: column prefix cache */
39
ulint i, /* in: index of ext->ext[] */
40
ulint* len) /* out: length of prefix, in bytes,
41
at most REC_MAX_INDEX_COL_LEN */
45
ut_ad(i < ext->n_ext);
49
if (UNIV_UNLIKELY(*len == 0)) {
50
/* The BLOB could not be fetched to the cache. */
51
return(field_ref_zero);
53
return(ext->buf + i * REC_MAX_INDEX_COL_LEN);
57
/************************************************************************
58
Looks up a column prefix of an externally stored column. */
63
/* out: column prefix, or NULL if
64
the column is not stored externally,
65
or pointer to field_ref_zero
66
if the BLOB pointer is unset */
67
const row_ext_t* ext, /* in: column prefix cache */
68
ulint col, /* in: column number in the InnoDB
69
table object, as reported by
70
dict_col_get_no(); NOT relative to the
71
records in the clustered index */
72
ulint* len) /* out: length of prefix, in bytes,
73
at most REC_MAX_INDEX_COL_LEN */
80
for (i = 0; i < ext->n_ext; i++) {
81
if (col == ext->ext[i]) {
82
return(row_ext_lookup_ith(ext, i, len));