Debian Codegraph @

storage/innobase/include/row0ext.ic

raw
1 /*****************************************************************************
2
3 Copyright (c) 2006, 2026, Oracle and/or its affiliates.
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, version 2.0, as published by the
7 Free Software Foundation.
8
9 This program is designed to work with certain software (including
10 but not limited to OpenSSL) that is licensed under separate terms,
11 as designated in a particular file or component or in included license
12 documentation. The authors of MySQL hereby grant you an additional
13 permission to link the program and your derivative works with the
14 separately licensed software that they have either included with
15 the program or referenced in the documentation.
16
17 This program is distributed in the hope that it will be useful, but WITHOUT
18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
20 for more details.
21
22 You should have received a copy of the GNU General Public License along with
23 this program; if not, write to the Free Software Foundation, Inc.,
24 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
26 *****************************************************************************/
27
28 /** @file include/row0ext.ic
29 Caching of externally stored column prefixes
30
31 Created September 2006 Marko Makela
32 *******************************************************/
33
34 #include "btr0types.h"
35 #include "rem0types.h"
36
37 inline const byte *row_ext_lookup_ith(const row_ext_t *ext, ulint i,
38 ulint *len) {
39 ut_ad(i < ext->n_ext);
40
41 *len = ext->len[i];
42
43 ut_ad(ext->max_len > 0);
44 ut_ad(*len <= ext->max_len);
45
46 if (*len == 0) {
47 /* The BLOB could not be fetched to the cache. */
48 return field_ref_zero;
49 } else {
50 return ext->buf + i * ext->max_len;
51 }
52 }
53
54 inline const byte *row_ext_lookup(const row_ext_t *ext, ulint col, ulint *len) {
55 for (size_t i = 0; i < ext->n_ext; ++i) {
56 if (col == ext->ext[i]) {
57 return row_ext_lookup_ith(ext, i, len);
58 }
59 }
60
61 return nullptr;
62 }