641.2.2
by Monty Taylor
InnoDB Plugin 1.0.3 |
1 |
/*****************************************************************************
|
2 |
||
3 |
Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved.
|
|
4 |
||
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.
|
|
8 |
||
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.
|
|
12 |
||
13 |
You should have received a copy of the GNU General Public License along with
|
|
1802.10.2
by Monty Taylor
Update all of the copyright headers to include the correct address. |
14 |
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
|
15 |
St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
641.2.2
by Monty Taylor
InnoDB Plugin 1.0.3 |
16 |
|
17 |
*****************************************************************************/
|
|
18 |
||
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
19 |
/**************************************************//**
|
20 |
@file include/row0ext.ic
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
21 |
Caching of externally stored column prefixes
|
22 |
||
23 |
Created September 2006 Marko Makela
|
|
24 |
*******************************************************/
|
|
25 |
||
26 |
#include "rem0types.h" |
|
27 |
#include "btr0types.h" |
|
28 |
||
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
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 */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
33 |
UNIV_INLINE
|
34 |
const byte* |
|
35 |
row_ext_lookup_ith( |
|
36 |
/*===============*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
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, |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
40 |
at most REC_MAX_INDEX_COL_LEN */
|
41 |
{
|
|
42 |
ut_ad(ext); |
|
43 |
ut_ad(len); |
|
44 |
ut_ad(i < ext->n_ext); |
|
45 |
||
46 |
*len = ext->len[i]; |
|
47 |
||
48 |
if (UNIV_UNLIKELY(*len == 0)) { |
|
49 |
/* The BLOB could not be fetched to the cache. */ |
|
50 |
return(field_ref_zero); |
|
51 |
} else { |
|
52 |
return(ext->buf + i * REC_MAX_INDEX_COL_LEN); |
|
53 |
} |
|
54 |
}
|
|
55 |
||
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
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 */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
60 |
UNIV_INLINE
|
61 |
const byte* |
|
62 |
row_ext_lookup( |
|
63 |
/*===========*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
64 |
const row_ext_t* ext, /*!< in: column prefix cache */ |
65 |
ulint col, /*!< in: column number in the InnoDB |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
66 |
table object, as reported by
|
67 |
dict_col_get_no(); NOT relative to the
|
|
68 |
records in the clustered index */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
69 |
ulint* len) /*!< out: length of prefix, in bytes, |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
70 |
at most REC_MAX_INDEX_COL_LEN */
|
71 |
{
|
|
72 |
ulint i; |
|
73 |
||
74 |
ut_ad(ext); |
|
75 |
ut_ad(len); |
|
76 |
||
77 |
for (i = 0; i < ext->n_ext; i++) { |
|
78 |
if (col == ext->ext[i]) { |
|
79 |
return(row_ext_lookup_ith(ext, i, len)); |
|
80 |
} |
|
81 |
} |
|
82 |
||
83 |
return(NULL); |
|
84 |
}
|